diff --git a/apps/docs/api-reference-generator/plans/createPlan.mdx b/apps/docs/api-reference-generator/plans/createPlan.mdx new file mode 100644 index 000000000..d5b571877 --- /dev/null +++ b/apps/docs/api-reference-generator/plans/createPlan.mdx @@ -0,0 +1,139 @@ +--- +title: "Create a plan" +openapi: "openapi POST /v1/plans.create" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +Creates a new plan with optional base price and feature configurations. See [How plans work](/documentation/pricing/plans) for concepts and [Adding features to plans](/documentation/pricing/plan-features) for item configuration. + +### Plan Configuration + +A plan consists of: +- **Base price** - optional recurring charge for the plan itself +- **Items** - feature configurations defining what customers get and how they're billed + +### Configuring Items + +Each item in the `items` array configures a single feature. There are two types: + +**Consumable features** (API calls, messages, credits): +- Set `included` for free units that reset each period +- Set `reset.interval` to define when balance resets to `included` +- Optionally add `price` for usage beyond included amount + +**Non-consumable features** (seats, storage): +- Set `included` for the base allocation +- Do NOT set `reset` - usage persists across billing cycles +- Use `billing_method: "prepaid"` for upfront payment per unit + +### Common Use Cases + + + +```typescript Free plan with auto-enable +await autumn.plans.create({ + planId: "free_plan", + name: "Free", + autoEnable: true, // Automatically attached on customer creation + items: [ + { + featureId: "messages", + included: 100, + reset: { interval: "month" } + } + ] +}); +``` + +```typescript Paid plan with base price + usage-based feature +await autumn.plans.create({ + planId: "pro_plan", + name: "Pro Plan", + price: { amount: 10, interval: "month" }, + items: [ + { + featureId: "messages", + included: 1000, + reset: { interval: "month" }, + price: { + amount: 0.01, + interval: "month", + billingUnits: 1, + billingMethod: "usage_based" + } + } + ] +}); +``` + +```typescript Plan with prepaid seats +await autumn.plans.create({ + planId: "team_plan", + name: "Team Plan", + price: { amount: 49, interval: "month" }, + items: [ + { + featureId: "seats", + included: 5, + // No reset - seats persist across billing cycles + price: { + amount: 10, + interval: "month", + billingUnits: 1, + billingMethod: "prepaid" + } + } + ] +}); +``` + +```typescript Add-on plan +await autumn.plans.create({ + planId: "analytics_addon", + name: "Advanced Analytics", + addOn: true, // Can be attached alongside other plans + price: { amount: 20, interval: "month" } +}); +``` + +```typescript Plan with tiered pricing +await autumn.plans.create({ + planId: "api_plan", + name: "API Plan", + items: [ + { + featureId: "api_calls", + included: 1000, + reset: { interval: "month" }, + price: { + tiers: [ + { to: 10000, amount: 0.001 }, + { to: 100000, amount: 0.0005 }, + { to: "inf", amount: 0.0001 } + ], + interval: "month", + billingUnits: 1, + billingMethod: "usage_based" + } + } + ] +}); +``` + +```typescript Plan with free trial +await autumn.plans.create({ + planId: "premium_plan", + name: "Premium", + price: { amount: 99, interval: "month" }, + freeTrial: { + durationLength: 14, + durationType: "day", + cardRequired: true + } +}); +``` + + diff --git a/apps/docs/api-reference-generator/plans/deletePlan.mdx b/apps/docs/api-reference-generator/plans/deletePlan.mdx new file mode 100644 index 000000000..bc77a34f2 --- /dev/null +++ b/apps/docs/api-reference-generator/plans/deletePlan.mdx @@ -0,0 +1,33 @@ +--- +title: "Delete a plan" +openapi: "openapi POST /v1/plans.delete" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +Deletes a plan or a specific version of a plan. + + + Deleting a plan cannot be undone. Existing subscriptions to this plan will remain active until canceled. + + +### Common Use Cases + + + +```typescript Delete latest version +await autumn.plans.delete({ + planId: "old_plan" +}); +``` + +```typescript Delete all versions +await autumn.plans.delete({ + planId: "old_plan", + allVersions: true +}); +``` + + diff --git a/apps/docs/api-reference-generator/plans/getPlan.mdx b/apps/docs/api-reference-generator/plans/getPlan.mdx new file mode 100644 index 000000000..f0ba70ba4 --- /dev/null +++ b/apps/docs/api-reference-generator/plans/getPlan.mdx @@ -0,0 +1,29 @@ +--- +title: "Get a plan" +openapi: "openapi POST /v1/plans.get" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +Retrieves a single plan by its ID. Returns the latest version by default. + +### Common Use Cases + + + +```typescript Get a plan +const plan = await autumn.plans.get({ + planId: "pro_plan" +}); +``` + +```typescript Get a specific version +const plan = await autumn.plans.get({ + planId: "pro_plan", + version: 2 +}); +``` + + diff --git a/apps/docs/api-reference-generator/plans/listPlans.mdx b/apps/docs/api-reference-generator/plans/listPlans.mdx new file mode 100644 index 000000000..4c5b73639 --- /dev/null +++ b/apps/docs/api-reference-generator/plans/listPlans.mdx @@ -0,0 +1,40 @@ +--- +title: "List all plans" +openapi: "openapi POST /v1/plans.list" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +Lists all plans in the current environment. + + + Pass a `customer_id` to include customer-specific eligibility info like whether a free trial is available and the attach scenario (new, upgrade, downgrade). + + +### Common Use Cases + + + +```typescript List all plans +const plans = await autumn.plans.list(); +``` + +```typescript List plans with customer eligibility +const plans = await autumn.plans.list({ + customerId: "cus_123" +}); + +// Each plan will include customerEligibility: +// - trialAvailable: whether customer can use the trial +// - scenario: 'new', 'upgrade', 'downgrade', etc. +``` + +```typescript Include archived plans +const plans = await autumn.plans.list({ + includeArchived: true +}); +``` + + diff --git a/apps/docs/api-reference-generator/plans/updatePlan.mdx b/apps/docs/api-reference-generator/plans/updatePlan.mdx new file mode 100644 index 000000000..3b1d82a3d --- /dev/null +++ b/apps/docs/api-reference-generator/plans/updatePlan.mdx @@ -0,0 +1,68 @@ +--- +title: "Update a plan" +openapi: "openapi POST /v1/plans.update" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +Updates an existing plan. By default, creates a new version of the plan. See [Adding features to plans](/documentation/pricing/plan-features) for item configuration. + + + Updates create a new plan version by default. Existing customers remain on their current version until their subscription renews or they explicitly upgrade. + + +### Updating Items + +When updating `items`, you must provide the complete items array. The new array replaces the existing configuration entirely. + +To update a single feature's configuration while keeping others unchanged, include all existing items with the modified values. + +### Common Use Cases + + + +```typescript Update plan price +await autumn.plans.update({ + planId: "pro_plan", + price: { amount: 15, interval: "month" } +}); +``` + +```typescript Remove base price (usage-only plan) +await autumn.plans.update({ + planId: "pro_plan", + price: null // Removes the base price +}); +``` + +```typescript Update feature's included amount +await autumn.plans.update({ + planId: "pro_plan", + items: [ + { + featureId: "messages", + included: 2000, // Increased from 1000 + reset: { interval: "month" } + } + ] +}); +``` + +```typescript Archive a plan +await autumn.plans.update({ + planId: "old_plan", + archived: true +}); +``` + +```typescript Rename a plan +await autumn.plans.update({ + planId: "pro_plan", + name: "Pro Plan (Updated)", + newPlanId: "pro_plan_v2" // Optional: change the plan ID +}); +``` + + diff --git a/apps/docs/mintlify/api-reference/batch.yaml b/apps/docs/mintlify/api-reference/batch.yaml deleted file mode 100644 index d7528db44..000000000 --- a/apps/docs/mintlify/api-reference/batch.yaml +++ /dev/null @@ -1,332 +0,0 @@ -openapi: 3.0.1 -info: - title: Autumn API - description: API to interact with Autumn - license: - name: MIT - version: 1.0.0 - -servers: - - url: https://api.useautumn.com/v1/batch - -security: - - secretKeyAuth: [] - -paths: - /customers: - post: - summary: Batch retrieve customers - description: Retrieve a paginated list of customers with their associated products and entitlements - operationId: batchGetCustomers - tags: - - Batch Operations - requestBody: - required: true - content: - application/json: - schema: - type: object - required: - - limit - properties: - limit: - type: integer - description: Number of customers to retrieve (Must be between 10 and 100) - example: 100 - offset: - type: integer - default: 0 - description: Number of customers to skip for pagination - example: 100 - statuses: - type: array - default: ["active"] - items: - type: string - enum: - - scheduled - - active - - past_due - - expired - - unknown - - trialing - description: Filter customers by product status - example: ["expired", "past_due"] - examples: - basic: - summary: Basic request - value: - limit: 50 - with-filters: - summary: With status filters - value: - limit: 100 - offset: 100 - statuses: ["expired", "past_due"] - responses: - "200": - description: Successful response with paginated customer list - content: - application/json: - schema: - type: object - required: - - list - - total - properties: - list: - type: array - items: - $ref: "#/components/schemas/Customer" - description: Array of customer objects - total: - type: integer - description: Total number of customers in the result set - example: 25 - examples: - success: - summary: Successful response - value: - list: - - id: "John Doe" - created_at: 1756301935674 - name: "John Doe" - email: "john@example.com" - fingerprint: null - stripe_id: null - env: "sandbox" - products: - - id: "free" - name: "free" - group: null - status: "active" - canceled_at: null - started_at: 1756310054931 - is_default: true - is_add_on: false - version: 2 - items: - - type: "feature" - feature_id: "message" - feature_type: "single_use" - feature: - id: "message" - name: "Send Message" - type: "single_use" - display: - singular: "message" - plural: "messages" - included_usage: 1000 - interval: "month" - interval_count: 1 - reset_usage_when_enabled: true - entity_feature_id: null - features: - message: - id: "message" - name: "Send Message" - type: "single_use" - unlimited: false - balance: 1000 - usage: 0 - included_usage: 1000 - next_reset_at: 1758980335931 - interval: "month" - interval_count: 1 - overage_allowed: false - metadata: {} - - id: "John Doe" - created_at: 1756301935674 - name: "John Doe" - email: "john@example.com" - fingerprint: null - stripe_id: null - env: "sandbox" - products: - - id: "free" - name: "free" - group: null - status: "active" - canceled_at: null - started_at: 1756310054931 - is_default: true - is_add_on: false - version: 2 - items: - - type: "feature" - feature_id: "message" - feature_type: "single_use" - feature: - id: "message" - name: "Send Message" - type: "single_use" - display: - singular: "message" - plural: "messages" - included_usage: 1000 - interval: "month" - interval_count: 1 - reset_usage_when_enabled: true - entity_feature_id: null - features: - message: - id: "message" - name: "Send Message" - type: "single_use" - unlimited: false - balance: 1000 - usage: 0 - included_usage: 1000 - next_reset_at: 1758980335931 - interval: "month" - interval_count: 1 - overage_allowed: false - metadata: {} - total: 1 - -components: - securitySchemes: - secretKeyAuth: - type: http - scheme: bearer - description: Use your Autumn Secret Key as the Bearer token. - - schemas: - Customer: - type: object - properties: - id: - type: string - description: Customer ID provided by user - example: "cus_123" - name: - type: string - description: Customer name - example: "John Doe" - email: - type: string - description: Customer email address - example: "john@example.com" - fingerprint: - type: string - description: Customer fingerprint for identification - example: "fp_abc123" - internal_id: - type: string - description: Internal Autumn customer ID - example: "int_123" - created_at: - type: integer - description: Customer creation timestamp (Unix timestamp in milliseconds) - example: 1640995200000 - metadata: - type: object - description: Additional customer metadata - additionalProperties: true - example: {} - customer_products: - type: array - items: - $ref: "#/components/schemas/CustomerProduct" - description: Associated customer products - entitlements: - type: array - items: - $ref: "#/components/schemas/CustomerEntitlement" - description: Customer entitlements and balances - - CustomerProduct: - type: object - properties: - id: - type: string - description: Customer product ID - product_id: - type: string - description: Associated product ID - status: - type: string - enum: - - scheduled - - active - - past_due - - expired - - unknown - - trialing - description: Product status - created_at: - type: integer - description: Product creation timestamp - starts_at: - type: integer - description: Product start timestamp - canceled_at: - type: integer - nullable: true - description: Product cancellation timestamp - ended_at: - type: integer - nullable: true - description: Product end timestamp - trial_ends_at: - type: integer - nullable: true - description: Trial end timestamp - quantity: - type: integer - description: Product quantity - default: 1 - collection_method: - type: string - enum: - - charge_automatically - - send_invoice - description: Payment collection method - - CustomerEntitlement: - type: object - properties: - id: - type: string - description: Entitlement ID - feature_id: - type: string - description: Associated feature ID - balance: - type: number - description: Current balance - adjustment: - type: number - description: Balance adjustment - next_reset_at: - type: integer - nullable: true - description: Next balance reset timestamp - created_at: - type: integer - description: Entitlement creation timestamp - - Error: - type: object - required: - - error - properties: - error: - type: object - required: - - code - - message - properties: - code: - type: string - description: Error code - enum: - - invalid_inputs - - invalid_request - - no_secret_key - - invalid_secret_key - - customers_not_found - - internal_error - message: - type: string - description: Human-readable error message diff --git a/apps/docs/mintlify/api-reference/batch/customers/post.mdx b/apps/docs/mintlify/api-reference/batch/customers/post.mdx deleted file mode 100644 index 57110faa4..000000000 --- a/apps/docs/mintlify/api-reference/batch/customers/post.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "Batch Retrieve Customers" -openapi: "batch POST /customers" ---- diff --git a/apps/docs/mintlify/api-reference/billing/billingAttach.mdx b/apps/docs/mintlify/api-reference/billing/billingAttach.mdx index 31958eb28..f7d0e1380 100644 --- a/apps/docs/mintlify/api-reference/billing/billingAttach.mdx +++ b/apps/docs/mintlify/api-reference/billing/billingAttach.mdx @@ -85,11 +85,17 @@ const response = await autumn.billing.attach({ Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial ('day', 'month', 'year'). + - + + If true, payment method required to start trial. Customer is charged after trial ends. + @@ -99,37 +105,58 @@ const response = await autumn.billing.attach({ - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + - + + The ID of the feature to configure. + - + + Number of free units included. Balance resets to this each interval for consumable features. + - + + If true, customer has unlimited access to this feature. + + Reset configuration for consumable features. Omit for non-consumable features like seats. - + + Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + - + + Number of intervals between resets. Defaults to 1. + + Pricing for usage beyond included units. Omit for free features. - + + Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + + Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. @@ -138,35 +165,57 @@ const response = await autumn.billing.attach({ - + + Billing interval. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + - + + 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + - + + Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + + Proration settings for prepaid features. Controls mid-cycle quantity change billing. - + + Billing behavior when quantity increases mid-cycle. + - + + Credit behavior when quantity decreases mid-cycle. + + Rollover config for unused units. If set, unused included units carry over. - + + Max rollover units. Omit for unlimited rollover. + - + + When rolled over units expire. + - + + Number of periods before expiry. + diff --git a/apps/docs/mintlify/api-reference/billing/billingUpdate.mdx b/apps/docs/mintlify/api-reference/billing/billingUpdate.mdx index 21da6626b..c4c6aedd2 100644 --- a/apps/docs/mintlify/api-reference/billing/billingUpdate.mdx +++ b/apps/docs/mintlify/api-reference/billing/billingUpdate.mdx @@ -74,11 +74,17 @@ const response = await autumn.billing.update({ Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial ('day', 'month', 'year'). + - + + If true, payment method required to start trial. Customer is charged after trial ends. + @@ -88,37 +94,58 @@ const response = await autumn.billing.update({ - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + - + + The ID of the feature to configure. + - + + Number of free units included. Balance resets to this each interval for consumable features. + - + + If true, customer has unlimited access to this feature. + + Reset configuration for consumable features. Omit for non-consumable features like seats. - + + Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + - + + Number of intervals between resets. Defaults to 1. + + Pricing for usage beyond included units. Omit for free features. - + + Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + + Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. @@ -127,35 +154,57 @@ const response = await autumn.billing.update({ - + + Billing interval. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + - + + 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + - + + Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + + Proration settings for prepaid features. Controls mid-cycle quantity change billing. - + + Billing behavior when quantity increases mid-cycle. + - + + Credit behavior when quantity decreases mid-cycle. + + Rollover config for unused units. If set, unused included units carry over. - + + Max rollover units. Omit for unlimited rollover. + - + + When rolled over units expire. + - + + Number of periods before expiry. + diff --git a/apps/docs/mintlify/api-reference/billing/previewAttach.mdx b/apps/docs/mintlify/api-reference/billing/previewAttach.mdx index 1b21eda9f..a09bd13a3 100644 --- a/apps/docs/mintlify/api-reference/billing/previewAttach.mdx +++ b/apps/docs/mintlify/api-reference/billing/previewAttach.mdx @@ -40,11 +40,17 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial ('day', 'month', 'year'). + - + + If true, payment method required to start trial. Customer is charged after trial ends. + @@ -54,37 +60,58 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + - + + The ID of the feature to configure. + - + + Number of free units included. Balance resets to this each interval for consumable features. + - + + If true, customer has unlimited access to this feature. + + Reset configuration for consumable features. Omit for non-consumable features like seats. - + + Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + - + + Number of intervals between resets. Defaults to 1. + + Pricing for usage beyond included units. Omit for free features. - + + Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + + Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. @@ -93,35 +120,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Billing interval. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + - + + 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + - + + Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + + Proration settings for prepaid features. Controls mid-cycle quantity change billing. - + + Billing behavior when quantity increases mid-cycle. + - + + Credit behavior when quantity decreases mid-cycle. + + Rollover config for unused units. If set, unused included units carry over. - + + Max rollover units. Omit for unlimited rollover. + - + + When rolled over units expire. + - + + Number of periods before expiry. + diff --git a/apps/docs/mintlify/api-reference/billing/previewUpdate.mdx b/apps/docs/mintlify/api-reference/billing/previewUpdate.mdx index 951f98f00..a6dd62f8d 100644 --- a/apps/docs/mintlify/api-reference/billing/previewUpdate.mdx +++ b/apps/docs/mintlify/api-reference/billing/previewUpdate.mdx @@ -40,11 +40,17 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial ('day', 'month', 'year'). + - + + If true, payment method required to start trial. Customer is charged after trial ends. + @@ -54,37 +60,58 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + - + + The ID of the feature to configure. + - + + Number of free units included. Balance resets to this each interval for consumable features. + - + + If true, customer has unlimited access to this feature. + + Reset configuration for consumable features. Omit for non-consumable features like seats. - + + Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + - + + Number of intervals between resets. Defaults to 1. + + Pricing for usage beyond included units. Omit for free features. - + + Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + + Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. @@ -93,35 +120,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Billing interval. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + - + + 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + - + + Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + + Proration settings for prepaid features. Controls mid-cycle quantity change billing. - + + Billing behavior when quantity increases mid-cycle. + - + + Credit behavior when quantity decreases mid-cycle. + + Rollover config for unused units. If set, unused included units carry over. - + + Max rollover units. Omit for unlimited rollover. + - + + When rolled over units expire. + - + + Number of periods before expiry. + diff --git a/apps/docs/mintlify/api-reference/billing/setupPayment.mdx b/apps/docs/mintlify/api-reference/billing/setupPayment.mdx index 0c6d351c2..7edf27002 100644 --- a/apps/docs/mintlify/api-reference/billing/setupPayment.mdx +++ b/apps/docs/mintlify/api-reference/billing/setupPayment.mdx @@ -69,3 +69,13 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx URL to the payment setup page + + + +```json 200 +{ + "customer_id": "cus_123", + "payment_url": "https://checkout.stripe.com/..." +} +``` + diff --git a/apps/docs/mintlify/api-reference/cli/config.mdx b/apps/docs/mintlify/api-reference/cli/config.mdx deleted file mode 100644 index 6fdcd17c4..000000000 --- a/apps/docs/mintlify/api-reference/cli/config.mdx +++ /dev/null @@ -1,330 +0,0 @@ ---- -title: "Product Config" -description: "Create your pricing plans and products via our CLI" ---- - -Products can be created via our dashboard, or via our CLI defined in an `autumn.config.ts` file. - -You can export `features` and `products` from this config file, and push them to Autumn using `npx atmn push` - - - CLI functionality is in beta. Please let us know any issues you run into and - we'll resolve them ASAP. - - -## Feature - -The features of your application that can be gated depending on pricing tier. These will be used to define your products. - - - The ID of the feature that will be used via Autumn's APIs. - - - - The display name of the feature - - - - One of `single_use`, `continuous_use`, `credit_system` or `boolean`. See below - for examples. - - -### Feature Types - -#### Single-use meter - -Single-use features are those that can be used-up and replenished. They may have a reset interval (eg 200 per month). - -Examples: AI messages, credits, API calls. - -```ts -export const messages = feature({ - id: "messages", - name: "Messages", - type: "single_use", -}); -``` - -#### Continuous-use meter - -Continuous-use features are those used on an ongoing basis. They do not reset periodically and may be prorated when billed for. - -Examples: Seats, storage, workspaces. - -```ts -export const messages = feature({ - id: "seats", - name: "Seats", - type: "continuous_use", -}); -``` - -#### Credit system - -Use a credit system when you have multiple metered features that each cost a different amount. - -Eg, if a basic model message costs 1 credit, and a premium message costs 5 credits. - - - If you set the price per credit to be 1 cent when you create your products, - these can be used as monetary credits (eg 0.05 USD per premium message) - - -```ts -export const credits = feature({ - id: "ai_credits", - name: "AI Credits", - type: "credit_system", - credit_schema: [ - { - metered_feature_id: basicMessage.id, - credit_cost: 1, - }, - { - metered_feature_id: premiumMessage.id, - credit_cost: 5, - }, - ], -}); -``` - -#### Boolean - -A feature flag that can be enabled or disabled. - -```ts -export const sso = feature({ - id: "sso", - name: "SSO Auth", - type: "boolean", -}); -``` - -## Products - -Products are made up of features and prices, and define your pricing plans. You should create products for any free plans, paid plans and any add-ons / top-up products. - - - The ID of the product that will be used via Autumn's APIs. - - - - The display name of the product. - - - - Whether the product should be attached by default to new customers - - - - Whether the product is an add-on and can be purchased alongside other products - (as opposed to trigger upgrade/downgrade flows) - - - - An array of objects that define the product. Can be one of: - - - `featureItem`: a feature to grant access to when the product is enabled - - `priceItem`: a fixed price to pay for the product - - `pricedFeatureItem`: a feature that has a price associated based on usage or quantity purchased. - - - -### Item Types - -Define your products using a combination of the 3 item types below. - -#### Feature Item - -A feature that is included with the product. - - - Feature ID for the product item - - - - How much usage is included with this item. This acts as a usage limit. Not - applicable for boolean features. - - - - -`month` | `hour` | `day` | `week` | `quarter` | `semi_annual` | `year` - -How often the feature's balance should be reset back to the included_usage. -Set as `null` for one-time grants. - - - - - The entity feature to assign this item to: eg, seats. This will set a usage - limit at the entity level (eg, 10 message per seat per month) - - -**Example** - -```ts -export const free = product({ - id: "free", - name: "Free", - is_default: true, - items: [ - // 5 messages per month - featureItem({ - feature_id: messages.id, - included_usage: 5, - interval: "month", - }), - // 3 seats (no reset) - featureItem({ - feature_id: seats.id, - included_usage: 3, - }), - // SSO Auth (boolean) - featureItem({ - feature_id: sso.id, - }), - ], -}); -``` - -#### Price Item - -A fixed price to be charged with the product: either one-time or a subscription. - - - A fixed amount to charge for this product - - - - -`month` | `quarter` | `semi_annual` | `year` - -How often this price should be billed to the customer. Set as `null` for -one-time prices. - - - -**Example** - -```ts -export const pro = product({ - id: "pro", - name: "Pro", - items: [ - // 20 USD per month - priceItem({ - price: 20, - interval: "month", - }), - // 5 USD (one-time price) - priceItem({ - price: 5, - }), - ], -}); -``` - -#### Priced Feature Item - -A price to be charged based on the usage or prepaid quantity of a feature. - - - Feature ID for the product item - - - - A fixed amount to charge per `billing_units` of this feature. - - - - The package quantity that the price is charged in (eg 5 USD for 100 messages) - - - - -`prepaid` | `pay_per_use` - -Whether the feature is charged based on how much is used (`pay_per_use`), or if a fixed quantity is purchased upfront (`prepaid`). - -For continuous use meters that are `pay_per_use` (eg paying per seat used), you can define billing behavior in the dashboard (eg, whether to bill immediately or at the end of the cycle). - - - - - How much usage is included with this item. - - - - -`month` | `quarter` | `semi_annual` | `year` - -How often this price should be billed to the customer. Set as `null` for -one-time prices. - - - - - The entity feature to assign this item to: eg, seats. This will set a usage - price at the entity level (eg, 0.01 USD per message per seat per month) - - -**Example** - -```ts -export const pro = product({ - id: "pro", - name: "Pro", - items: [ - // 100 messages included - // then, 0.01 USD per 10 messages - pricedFeatureItem({ - feature_id: messages.id, - included_usage: 100, - price: 0.01, - billing_units: 10, - }), - ], -}); -``` - -```ts -export const team = product({ - id: "team", - name: "team", - items: [ - // 20 USD per seat per month - // paying per seat used - pricedFeatureItem({ - feature_id: seats.id, - price: 20, - interval: "month", - }), - // 10 USD per seat per month - // paying upfront for a fixed quantity - pricedFeatureItem({ - feature_id: seats.id, - price: 10, - interval: "month", - usage_model: "prepaid", - }), - ], -}); -``` - -```ts -export const topUp = product({ - id: "top_up", - name: "Credit top up", - items: [ - // 5 USD per 100 credits - // one-time payment (+ credits don't reset periodically) - pricedFeatureItem({ - feature_id: credits.id, - price: 5, - billing_units: 100, - usage_model: "prepaid", - }), - ], -}); -``` diff --git a/apps/docs/mintlify/api-reference/coreapi.yaml b/apps/docs/mintlify/api-reference/coreapi.yaml deleted file mode 100644 index a6f549f40..000000000 --- a/apps/docs/mintlify/api-reference/coreapi.yaml +++ /dev/null @@ -1,1339 +0,0 @@ -openapi: 3.0.1 -info: - title: Autumn API - description: API to interact with Autumn - license: - name: MIT - version: 1.0.0 - -servers: - - url: https://api.useautumn.com/v1 - -security: - - secretKeyAuth: [] - -paths: - /checkout: - post: - security: - - secretKeyAuth: [] - description: Returns a Stripe Checkout URL for the customer to make a payment, or returns payment confirmation information. - requestBody: - description: "" - content: - application/json: - schema: - type: object - required: - - customer_id - - product_id - properties: - customer_id: - type: string - description: Your unique identifier for the customer - product_id: - type: string - description: Product ID, set when creating the product in the Autumn dashboard - product_ids: - type: array - description: List of product IDs to attach to the customer in the same subscription or transaction - items: - type: string - success_url: - type: string - description: URL to redirect to after the purchase is successful - options: - type: array - description: Pass in quantities for prepaid features. - items: - type: object - properties: - feature_id: - type: string - description: Feature ID of the feature that will be affected by the options. - quantity: - type: integer - description: Quantity of the feature (eg number of seats) to be purchased. Required if billing is in-advance usage-based. - reward: - type: string - description: An Autumn promo_code or reward_id to apply at checkout. - entity_id: - type: string - description: If using [entities](/features/feature-entities), the entity to attach the product to. - customer_data: - $ref: "#/components/schemas/CustomerData" - checkout_session_params: - type: object - description: Additional parameters to pass onto Stripe when creating the checkout session. - x-code-samples: - - lang: typescript - label: required - source: | - import { Autumn as autumn } from 'autumn-js' - - const response = await autumn.checkout({ - customer_id: 'user_123', - product_id: 'pro' - }) - - lang: typescript - label: with customer_data - source: | - import { Autumn as autumn } from 'autumn-js'; - - const response = await autumn.checkout({ - customer_id: 'user_123', - product_id: 'pro', - customer_data: { - name: 'John Yeo', - email: 'john@example.com' - } - }); - - lang: curl - source: | - curl -X POST 'https://api.useautumn.com/v1/checkout' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "customer_id": "user_123", - "product_id": "pro" - }' - - lang: python - label: required - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn("am_sk_1234567890") - - async def main(): - response = await autumn.checkout( - customer_id='user_123', - product_id='pro' - ) - - asyncio.run(main()) - - lang: python - label: with customer_data - source: | - import asyncio - from autumn import Autumn, CustomerData - - autumn = Autumn("am_sk_1234567890") - - async def main(): - response = await autumn.checkout( - customer_id='user_123', - product_id='pro', - customer_data=CustomerData( - name='John Yeo', - email='john@example.com' - ) - ) - - asyncio.run(main()) - responses: - "200": - description: " " - content: - application/json: - schema: - type: object - examples: - checkout url: - value: - url: "https://checkout.stripe.com/c/pay/cs_test_b1aiNVtSaxIymaUwIgzyDqxsX9TryoFzm8uS0nhncxN6TXFKCydjB9waEk#fid2cGd2ZndsdXFsamtQa2x0cGBrYHZ2QGtkZ2lgYSc%2FY2RpdmApJ2R1bE5gfCc%2FJ3VuWnFgdnFaMDRVajE2YUJNal9QRHVdXWFUVU90T0xNN3NUSXRdXWNqbEw9RGd2QlF9TkhdSU9VU29uSFFRSzJzVUJoVzFxalFhZzw0QmBUUXI9ckZDbGNEQ39nM1N9aGM1NWN2cTN0QWtrJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ2hwaXFsWmxxYGgnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl" - customer_id: "b" - lines: [] - product: - id: "pro" - name: "Pro" - group: null - env: "sandbox" - is_add_on: false - is_default: false - version: 2 - created_at: 1753805339212 - items: - - type: "price" - feature_id: null - feature: null - interval: "month" - price: 20 - - type: "priced_feature" - feature_id: "messages" - feature_type: "single_use" - feature: - id: "messages" - name: "Messages" - type: "single_use" - display: - singular: "message" - plural: "messages" - included_usage: 100 - interval: "month" - price: 0.1 - usage_model: "pay_per_use" - billing_units: 1 - reset_usage_when_enabled: false - entity_feature_id: null - free_trial: null - base_variant_id: null - scenario: "new" - properties: - is_free: false - is_one_off: false - interval_group: "month" - has_trial: false - updateable: false - upgrades and downgrades: - value: - customer_id: "a" - lines: - - description: "Unused Pro - $20 / month (from 29 Jul 2025)" - amount: -19.92096809289128 - item: - type: "price" - feature_id: null - feature: null - interval: "month" - price: 20 - display: - primary_text: "$20" - secondary_text: "per month" - - description: "Pro - 200 messages" - amount: 10 - item: - type: "priced_feature" - feature_id: "messages" - feature_type: "single_use" - feature: - id: "messages" - name: "Messages" - type: "single_use" - display: - singular: "message" - plural: "messages" - included_usage: 100 - interval: "month" - price: 0.1 - usage_model: "pay_per_use" - billing_units: 1 - reset_usage_when_enabled: false - entity_feature_id: null - display: - primary_text: "100 message" - secondary_text: "then $0.1 per message" - - description: "Ultra - $100 / month (from 29 Jul 2025)" - amount: 99.60484046445639 - item: - type: "price" - feature_id: null - feature: null - interval: "month" - price: 100 - display: - primary_text: "$100" - secondary_text: "per month" - product: - id: "ultra" - name: "Ultra" - group: null - env: "sandbox" - is_add_on: false - is_default: false - version: 1 - created_at: 1753816049300 - items: - - type: "price" - feature_id: null - feature: null - interval: "month" - price: 100 - display: - primary_text: "$100" - secondary_text: "per month" - - type: "feature" - feature_id: "messages" - feature_type: "single_use" - feature: - id: "messages" - name: "Messages" - type: "single_use" - display: - singular: "message" - plural: "messages" - included_usage: 100 - interval: "month" - reset_usage_when_enabled: true - entity_feature_id: null - display: - primary_text: "100 message" - free_trial: null - base_variant_id: null - scenario: "upgrade" - properties: - is_free: false - is_one_off: false - interval_group: "month" - has_trial: false - updateable: false - current_product: - id: "pro" - name: "Pro" - group: null - env: "sandbox" - is_add_on: false - is_default: false - version: 2 - created_at: 1753805339212 - items: - - type: "price" - feature_id: null - feature: null - interval: "month" - price: 20 - display: - primary_text: "$20" - secondary_text: "per month" - - type: "priced_feature" - feature_id: "messages" - feature_type: "single_use" - feature: - id: "messages" - name: "Messages" - type: "single_use" - display: - singular: "message" - plural: "messages" - included_usage: 100 - interval: "month" - price: 0.1 - usage_model: "pay_per_use" - billing_units: 1 - reset_usage_when_enabled: false - entity_feature_id: null - display: - primary_text: "100 message" - secondary_text: "then $0.1 per message" - free_trial: null - base_variant_id: null - scenario: "new" - properties: - is_free: false - is_one_off: false - interval_group: "month" - has_trial: false - updateable: false - total: 89.68387237156512 - currency: "USD" - next_cycle: - starts_at: 1756483882000 - total: 100 - options: [] - has_prorations: true - - /attach: - post: - security: - - secretKeyAuth: [] - description: Enables a product and handles a payment if the customer's card is already on file. - requestBody: - description: "" - content: - application/json: - schema: - type: object - required: - - customer_id - - product_id - properties: - customer_id: - type: string - description: Your unique identifier for the customer - product_id: - type: string - description: Product ID, set when creating the product in the Autumn dashboard - product_ids: - type: array - description: List of product IDs to attach to the customer in the same subscription or transaction - items: - type: string - success_url: - type: string - description: URL to redirect to after the purchase is successful - options: - type: array - description: Pass in quantities for prepaid features. - items: - type: object - properties: - feature_id: - type: string - description: Feature ID of the feature that will be affected by the options. - quantity: - type: integer - description: Quantity of the feature (eg number of seats) to be purchased. Required if billing is in-advance usage-based. - reward: - type: string - description: An Autumn promo_code or reward_id to apply at checkout. - entity_id: - type: string - description: If using [entities](/features/feature-entities), the entity to attach the product to. - force_checkout: - type: boolean - default: false - description: Always return a Stripe Checkout URL, even if the customer's card is already on file. - customer_data: - $ref: "#/components/schemas/CustomerData" - metadata: - type: object - description: Additional metadata to pass onto Stripe. - checkout_session_params: - type: object - description: Additional parameters to pass onto Stripe when creating the checkout session. - x-code-samples: - - lang: typescript - label: required - source: | - import { Autumn as autumn } from 'autumn-js' - - const response = await autumn.attach({ - customer_id: 'user_123', - product_id: 'pro' - }) - - lang: typescript - label: with customer_data - source: | - import { Autumn as autumn } from 'autumn-js'; - - const response = await autumn.attach({ - customer_id: 'user_123', - product_id: 'pro', - customer_data: { - name: 'John Yeo', - email: 'john@example.com' - } - }); - - lang: curl - source: | - curl -X POST 'https://api.useautumn.com/v1/attach' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "customer_id": "user_123", - "product_id": "pro" - }' - - lang: python - label: required - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn("am_sk_1234567890") - - async def main(): - response = await autumn.attach( - customer_id='user_123', - product_id='pro' - ) - - asyncio.run(main()) - - lang: python - label: with customer_data - source: | - import asyncio - from autumn import Autumn, CustomerData - - autumn = Autumn("am_sk_1234567890") - - async def main(): - response = await autumn.attach( - customer_id='user_123', - product_id='pro', - customer_data=CustomerData( - name='John Yeo', - email='john@example.com' - ) - ) - - asyncio.run(main()) - responses: - "200": - description: Customer attached - content: - application/json: - schema: - type: object - properties: - checkout_url: - type: string - description: URL to the Stripe checkout page. Only present if payment is required. - success: - type: boolean - description: Indicates if the product change was successful. Only present if payment is not required. - message: - type: string - description: Description of the action taken - examples: - upgrades and downgrades: - value: - customer_id: "a" - product_ids: - - "pro" - code: "updated_product_successfully" - message: "Successfully updated product" - - /customers/{customer_id}/billing_portal: - post: - description: Get the customer's Stripe billing portal URL, so they can manage their subscription and see invoice history. - parameters: - - name: customer_id - in: path - required: true - schema: - type: string - description: ID which you provided when creating the customer - requestBody: - content: - application/json: - schema: - type: object - properties: - return_url: - type: string - description: URL to return to after the customer is finished in the billing portal - x-code-samples: - - lang: typescript - source: | - import { Autumn as autumn } from 'autumn-js'; - - const response = await autumn.customers.billingPortal('user_123', { - return_url: 'https://example.com/account' - }); - - lang: curl - source: | - curl -X POST 'https://api.useautumn.com/v1/customers/user_123/billing_portal' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "return_url": "https://example.com/account" - }' - - lang: python - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn("am_sk_1234567890") - - async def main(): - response = await autumn.customers.get_billing_portal( - "user_123", returl_url="https://example.com/account" - ) - - asyncio.run(main()) - responses: - "200": - description: "" - content: - application/json: - schema: - type: object - properties: - url: - type: string - description: URL to access the customer's billing portal - example: - url: https://billing.stripe.com/session/ - - /track: - post: - description: Track a usage event in Autumn - requestBody: - content: - application/json: - schema: - type: object - required: - - customer_id - - feature_id - allOf: - - properties: - customer_id: - type: string - description: ID which you provided when creating the customer - - $ref: "#/components/schemas/EventData" - - properties: - customer_data: - $ref: "#/components/schemas/CustomerData" - x-code-samples: - - lang: typescript - label: with value - source: | - import { Autumn as autumn } from 'autumn-js'; - - await autumn.track({ - customer_id: 'user_123', - feature_id: 'messages', - value: 3 - }); - - - lang: typescript - label: single event - source: | - import { Autumn as autumn } from 'autumn-js'; - - await autumn.track({ - customer_id: 'user_123', - feature_id: 'messages' - }); - - - lang: typescript - label: with customer data - source: | - import { Autumn as autumn } from 'autumn-js'; - - await autumn.track({ - customer_id: 'user_123', - feature_id: 'messages', - value: 12, - customer_data: { - name: 'John Yeo', - email: 'john@useautumn.com' - } - }); - - - lang: typescript - label: with event name - source: | - import { Autumn as autumn } from 'autumn-js'; - - await autumn.track({ - customer_id: 'user_123', - event_name: 'mobile_messages', - value: 12 - }); - - - lang: bash - label: with value - source: | - curl -X POST 'https://api.useautumn.com/v1/track' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "customer_id": "user_123", - "feature_id": "messages", - "value": 3 - }' - - - lang: bash - label: single event - source: | - curl -X POST 'https://api.useautumn.com/v1/track' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "customer_id": "user_123", - "feature_id": "messages" - }' - - lang: python - label: with value - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn("am_sk_1234567890") - - async def main(): - await autumn.track( - customer_id='user_123', - feature_id='messages', - value=3 - ) - - asyncio.run(main()) - - lang: python - label: single event - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn("am_sk_1234567890") - - async def main(): - await autumn.track( - customer_id='user_123', - feature_id='messages', - ) - - asyncio.run(main()) - - lang: python - label: with customer data - source: | - import asyncio - from autumn import Autumn, CustomerData - - autumn = Autumn("am_sk_1234567890") - - async def main(): - await autumn.track( - customer_id='user_123', - feature_id='messages', - value=12, - customer_data=CustomerData( - name='John Yeo', - email='john@example.com' - ) - ) - - asyncio.run(main()) - - lang: python - label: with event name - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn("am_sk_1234567890") - - async def main(): - await autumn.track( - customer_id='user_123', - event_name='mobile_messages', - value=12 - ) - - asyncio.run(main()) - responses: - "200": - description: "" - content: - application/json: - schema: - type: object - properties: - id: - type: string - description: Unique identifier for the event - code: - type: string - description: Status code indicating the result of sending the event - customer_id: - type: string - description: Your unique identifier for the customer - feature_id: - type: string - description: ID of the feature being tracked - example: - id: "evt_2w5dzidzFD1cESxOGnn9frVuVcm" - code: "event_received" - customer_id: "user_123" - feature_id: "messages" - - /check: - post: - security: - - secretKeyAuth: [] - description: Check if a customer has access to a feature or product - requestBody: - content: - application/json: - schema: - type: object - required: - - customer_id - properties: - product_id: - type: string - description: ID of the product to check access to. Required if `feature_id` is not provided. - feature_id: - type: string - description: ID of the feature to check access to. Required if `product_id` is not provided. - customer_id: - type: string - description: ID which you provided when creating the customer - required_balance: - type: integer - default: 1 - description: If you know the amount of the feature the end user is consuming in advance. If their balance is below this quantity, `allowed` will be `false`. - send_event: - type: boolean - description: If true, a usage event will be recorded together with checking access. The `required_balance` field will be used as the usage `value`. - with_preview: - type: boolean - default: false - description: If true, the response will include a `preview` object, which can be used to display [information](/quickstart/ui-components) such as a paywall or upgrade confirmation. - entity_id: - type: string - description: If using [entity balances](/features/feature-entities) (eg, seats), the entity ID to check access for. - customer_data: - $ref: "#/components/schemas/CustomerData" - x-code-samples: - - lang: typescript - label: required - source: | - import { Autumn as autumn } from 'autumn-js'; - - const response = await autumn.check({ - customer_id: 'user_123', - feature_id: 'messages' - }); - - - lang: typescript - label: with event - source: | - import { Autumn as autumn } from 'autumn-js'; - - const response = await autumn.check({ - customer_id: 'user_123', - feature_id: 'messages', - required_balance: 12, - send_event: true - }); - - - lang: typescript - label: with customer data - source: | - import { Autumn as autumn } from 'autumn-js'; - - const response = await autumn.check({ - customer_id: 'user_123', - feature_id: 'messages', - customer_data: { - name: 'John Yeo', - email: 'john@useautumn.com' - } - }); - - - lang: curl - label: required - source: | - curl -X POST 'https://api.useautumn.com/v1/check' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "customer_id": "user_123", - "feature_id": "messages" - }' - - - lang: curl - label: with event - source: | - curl -X POST 'https://api.useautumn.com/v1/check' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "customer_id": "user_123", - "feature_id": "messages", - "required_balance": 12, - "send_event": true - }' - - - lang: curl - label: with customer data - source: | - curl -X POST 'https://api.useautumn.com/v1/check' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "customer_id": "user_123", - "feature_id": "messages", - "customer_data": { - "name": "John Yeo", - "email": "john@useautumn.com" - } - }' - - lang: python - label: required - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn('am_sk_1234567890') - - async def main(): - response = await autumn.check( - customer_id='user_123', - feature_id='messages' - ) - - asyncio.run(main()) - - lang: python - label: with event - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn('am_sk_1234567890') - - async def main(): - response = await autumn.check( - customer_id='user_123', - feature_id='messages', - required_balance=12, - send_event=True - ) - - asyncio.run(main()) - - - lang: python - label: with customer_data - source: | - import asyncio - from autumn import Autumn, CustomerData - - autumn = Autumn('am_sk_1234567890') - - async def main(): - response = await autumn.check( - customer_id='user_123', - feature_id='messages', - customer_data=CustomerData( - name='John Yeo', - email='john@useautumn.com' - ) - ) - - asyncio.run(main()) - responses: - "200": - description: "" - content: - application/json: - schema: - type: object - properties: - allowed: - type: boolean - description: Whether the customer has access to the feature or product - customer_id: - type: string - description: Your unique identifier for the customer - feature_id: - type: string - description: ID of the feature being checked - code: - type: string - description: Status code indicating the result of the check - balance: - type: object - description: Balances of the associated feature or credit system - properties: - feature_id: - type: string - description: ID of the feature - required_balance: - type: integer - description: Required amount of the feature - balance: - type: integer - description: Current balance of the feature - feature_preview: - type: object - description: Information about the feature, used to display information such as a paywall. Returned if check is called with a `feature_id` and `with_preview` is true. - properties: - title: - type: string - description: Title of the preview message - message: - type: string - description: Message to display to the user - scenario: - type: string - enum: - - usage_limit - - feature_flag - description: The scenario of the feature preview - feature_id: - type: string - description: ID of the feature - feature_name: - type: string - description: Name of the feature - products: - type: array - description: List of available products that include this feature - upgrade_product_id: - type: string - description: Next available product tier to upgrade to - product_preview: - type: object - description: Information about the product, used to display information such as an upgrade confirmation. Returned if check is called with a `product_id` and `with_preview` is true. - properties: - title: - type: string - description: Title of the preview message - message: - type: string - description: Message to display to the user - scenario: - type: string - enum: - - upgrade - - downgrade - - cancel - - renew - - scheduled - - active - description: The scenario of the product preview - product_id: - type: string - description: ID of the product - product_name: - type: string - description: Name of the product - recurring: - type: boolean - description: Whether the product is recurring - next_cycle_at: - type: integer - description: Timestamp of the next billing cycle - current_product_name: - type: string - description: Name of the current product - items: - type: array - description: List of items in the preview - items: - type: object - properties: - price: - type: string - description: Price of the item ($8) - description: - type: string - description: Description of the item (Eg, time used on Pro plan) - options: - type: array - description: List of available options required to attach the product (eg, quantity of seats) - due_today: - type: object - description: Amount due today - properties: - price: - type: number - description: Price amount - currency: - type: string - description: Currency code - due_next_cycle: - type: object - description: Amount due in next cycle - properties: - price: - type: number - description: Price amount - currency: - type: string - description: Currency code - example: - customer_id: "user_123" - feature_id: "messages" - code: "feature_found" - allowed: true - balance: { balance: 100, required_balance: 12 } - - /query: - post: - security: - - secretKeyAuth: [] - description: Query usage data for specific features over a time range - requestBody: - description: "" - content: - application/json: - schema: - type: object - required: - - customer_id - - feature_id - properties: - customer_id: - type: string - description: Your unique identifier for the customer - feature_id: - oneOf: - - type: string - - type: array - items: - type: string - description: Feature ID or array of feature IDs to query usage for - range: - type: string - enum: ["24h", "7d", "30d", "90d", "last_cycle"] - description: Time range for the query. Defaults to "30d" if not provided. `last_cycle` returns usage since the last billing cycle. - x-code-samples: - - lang: typescript - label: single feature - source: | - import { Autumn as autumn } from 'autumn-js' - - const response = await autumn.query({ - customer_id: 'user_123', - feature_id: 'messages', - range: '30d' - }) - - lang: typescript - label: multiple features - source: | - import { Autumn as autumn } from 'autumn-js' - - const response = await autumn.query({ - customer_id: 'user_123', - feature_id: ['credits', 'messages'], - range: '7d' - }) - - lang: curl - label: single feature - source: | - curl -X POST 'https://api.useautumn.com/v1/query' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "customer_id": "user_123", - "feature_id": "messages", - "range": "30d" - }' - - lang: curl - label: multiple features - source: | - curl -X POST 'https://api.useautumn.com/v1/query' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "customer_id": "user_123", - "feature_id": ["credits", "messages"], - "range": "7d" - }' - - lang: python - label: single feature - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn("am_sk_1234567890") - - async def main(): - response = await autumn.query( - customer_id='user_123', - feature_id='messages', - range='30d' - ) - - asyncio.run(main()) - - lang: python - label: multiple features - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn("am_sk_1234567890") - - async def main(): - response = await autumn.query( - customer_id='user_123', - feature_id=['credits', 'messages'], - range='7d' - ) - - asyncio.run(main()) - responses: - "200": - description: Usage data for the specified features - content: - application/json: - schema: - type: object - properties: - list: - type: array - description: List of usage data points for each time period - items: - type: object - properties: - period: - type: integer - description: Unix timestamp in milliseconds representing start of period - additionalProperties: - type: integer - description: Usage amount for each feature_id in the period - examples: - single feature: - value: - list: - - period: 1672531200000 - messages: 45 - - period: 1672617600000 - messages: 32 - - period: 1672704000000 - messages: 18 - multiple features: - value: - list: - - period: 1672531200000 - credits: 20 - messages: 45 - - period: 1672617600000 - credits: 15 - messages: 32 - - period: 1672704000000 - credits: 30 - messages: 18 - - /cancel: - post: - security: - - secretKeyAuth: [] - description: Cancel a customer's subscription or product attachment - requestBody: - description: "" - content: - application/json: - schema: - type: object - required: - - customer_id - - product_id - properties: - customer_id: - type: string - description: Your unique identifier for the customer - product_id: - type: string - description: Product ID to cancel for the customer - entity_id: - type: string - description: If using [entities](/features/feature-entities), the entity to cancel the product for. - cancel_immediately: - type: boolean - description: Whether to cancel the product immediately. If false, the product will be cancelled at the end of the billing cycle. - x-code-samples: - - lang: typescript - label: required - source: | - import { Autumn as autumn } from 'autumn-js' - - const response = await autumn.cancel({ - customer_id: 'user_123', - product_id: 'lite' - }) - - lang: typescript - label: with entity - source: | - import { Autumn as autumn } from 'autumn-js'; - - const response = await autumn.cancel({ - customer_id: 'user_123', - product_id: 'lite', - entity_id: '1' - }); - - lang: curl - label: required - source: | - curl -X POST 'https://api.useautumn.com/v1/cancel' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "customer_id": "user_123", - "product_id": "lite" - }' - - lang: curl - label: with entity - source: | - curl -X POST 'https://api.useautumn.com/v1/cancel' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "customer_id": "user_123", - "product_id": "lite", - "entity_id": "1" - }' - - lang: python - label: required - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn('am_sk_1234567890') - - async def main(): - response = await autumn.products.cancel( - customer_id='user_123', - product_id='lite' - ) - - asyncio.run(main()) - - lang: python - label: with entity - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn('am_sk_1234567890') - - async def main(): - response = await autumn.products.cancel( - customer_id='user_123', - product_id='lite', - entity_id='1', - ) - - asyncio.run(main()) - responses: - "200": - description: Product cancelled successfully - -components: - schemas: - CustomerData: - type: object - description: Additional customer properties. These will be used if the customer's properties are not already set. - properties: - name: - type: string - description: Name of the customer - email: - type: string - description: Email of the customer - fingerprint: - type: string - description: Unique fingerprint of the customer, used to prevent free trial abuse (eg serial_number, device_id, etc) - - EventData: - type: object - properties: - feature_id: - type: string - description: ID of the feature to track usage for. - value: - type: integer - default: 1 - description: How much usage should be deducted from the balance. Default is 1. - entity_id: - type: string - description: If using [entity balances](/features/feature-entities) (eg, seats), the entity ID to track usage for. - event_name: - type: string - description: An [event name](/features/tracking-usage#using-event-names) can be used in place of `feature_id`. This can be used if multiple features are tracked in the same event. - idempotency_key: - type: string - description: Unique identifier for the event. If the an event with the same key is sent multiple times, any subsequent events will be ignored and return an error. - properties: - type: object - description: Event properties that you can define. - - Error: - required: - - error - - message - type: object - properties: - error: - type: integer - format: int32 - message: - type: string - - securitySchemes: - secretKeyAuth: - type: http - scheme: bearer - description: Use your Autumn Secret Key as the Bearer token. diff --git a/apps/docs/mintlify/api-reference/customers.yaml b/apps/docs/mintlify/api-reference/customers.yaml deleted file mode 100644 index 5f943fd03..000000000 --- a/apps/docs/mintlify/api-reference/customers.yaml +++ /dev/null @@ -1,559 +0,0 @@ -openapi: 3.0.1 -info: - title: Autumn API - description: API to interact with Autumn - license: - name: MIT - version: 1.0.0 -servers: - - url: https://api.useautumn.com/v1 -security: - - bearerAuth: [Authorization] -paths: - /customers: - get: - security: - - secretKeyAuth: [] - summary: List customers - description: Retrieve a paginated list of customers - parameters: - - name: limit - in: query - required: false - schema: - type: integer - minimum: 10 - maximum: 100 - default: 10 - description: Maximum number of customers to return - - name: offset - in: query - required: false - schema: - type: integer - minimum: 0 - default: 0 - description: Number of customers to skip before returning results - x-code-samples: - - lang: typescript - source: | - import { Autumn as autumn } from 'autumn-js'; - - const { data } = await autumn.customers.list({ limit: 10, offset: 0 }); - - - lang: curl - source: | - curl 'https://api.useautumn.com/v1/customers?limit=10&offset=0' \ - -H 'Authorization: Bearer am_sk_1234567890' - - responses: - "200": - description: "" - content: - application/json: - schema: - type: object - properties: - list: - type: array - items: - $ref: "#/components/schemas/Customer" - total: - type: integer - description: Total number of customers available - limit: - type: integer - description: Maximum number of customers returned - offset: - type: integer - description: Number of customers skipped before returning results - post: - description: Create a new Autumn customer - requestBody: - required: true - content: - application/json: - schema: - type: object - required: - - id - properties: - id: - type: string - description: Your unique identifier for the customer - email: - type: string - description: Customer's email address - name: - type: string - description: Customer's name - fingerprint: - type: string - description: Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse - x-code-samples: - - lang: typescript - source: | - import { Autumn as autumn } from 'autumn-js'; - - const { data } = await autumn.customers.create({ - id: 'user_123', - name: 'John Yeo', - email: 'john@example.com' - }); - - - lang: curl - source: | - curl -X POST 'https://api.useautumn.com/v1/customers' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "id": "user_123", - "name": "John Yeo", - "email": "john@example.com" - }' - - lang: python - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn('am_sk_1234567890') - - async def main(): - customer = await autumn.customers.create( - id='user_123', - name='John Yeo', - email='john@example.com' - ) - - asyncio.run(main()) - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Customer" - example: - $ref: "#/components/examples/CustomerResponse/value" - - /customers/{customer_id}: - get: - security: - - secretKeyAuth: [] - summary: Get customer details - description: Retrieve detailed information about a specific customer including their subscriptions, add-ons, and entitlements - parameters: - - name: customer_id - in: path - required: true - schema: - type: string - description: Your unique identifier for the customer - - name: expand - in: query - required: false - schema: - type: array - items: - type: string - enum: ["invoices", "rewards", "trials_used", "entities", "referrals", "payment_method"] - style: form - explode: false - description: Array of additional data to include in the customer response. Options include invoices, rewards, trials_used, entities, referrals, payment_method - x-code-samples: - - lang: typescript - source: | - import { Autumn as autumn } from 'autumn-js'; - - const { data } = await autumn.customers.get('user_123'); - - - lang: curl - source: | - curl 'https://api.useautumn.com/v1/customers/user_123' \ - -H 'Authorization: Bearer am_sk_1234567890' - - - lang: python - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn('am_sk_1234567890') - - async def main(): - customer = await autumn.customers.get('user_123') - - asyncio.run(main()) - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Customer" - example: - $ref: "#/components/examples/CustomerResponse/value" - post: - security: - - secretKeyAuth: [] - summary: Update customer details - description: Update information for an existing customer - parameters: - - name: customer_id - in: path - required: true - schema: - type: string - description: Your unique identifier for the customer - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - id: - type: string - description: New ID to update the customer to (eg if switching from user to org) - name: - type: string - description: The customer's full name - email: - type: string - format: email - description: The customer's email address - fingerprint: - type: string - description: Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse - x-code-samples: - - lang: typescript - source: | - import { Autumn as autumn } from 'autumn-js'; - - const { data } = await autumn.customers.update('user_123', { - name: 'John Yeo', - email: 'john@example.com' - }); - - - lang: curl - source: | - curl -X POST 'https://api.useautumn.com/v1/customers/user_123' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "name": "John Yeo", - "email": "john@example.com" - }' - - - lang: python - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn('am_sk_1234567890') - - async def main(): - customer = await autumn.customers.update( - customer_id='user_123', - name='John Yeo', - email='john@example.com' - ) - - asyncio.run(main()) - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Customer" - example: - $ref: "#/components/examples/CustomerResponse/value" - delete: - security: - - secretKeyAuth: [] - summary: Delete a customer - description: Delete a customer - parameters: - - name: customer_id - in: path - required: true - schema: - type: string - description: Your unique identifier for the customer - - name: delete_in_stripe - in: query - required: false - schema: - type: boolean - default: false - description: Also delete the linked Stripe customer - x-code-samples: - - lang: typescript - source: | - import { Autumn as autumn } from 'autumn-js'; - - const { data } = await autumn.customers.delete('user_123', { - delete_in_stripe: true - }); - - - lang: curl - source: | - curl -X DELETE 'https://api.useautumn.com/v1/customers/user_123?delete_in_stripe=true' \ - -H 'Authorization: Bearer am_sk_1234567890' - - - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/Customer" - example: - $ref: "#/components/examples/CustomerResponse/value" -components: - examples: - CustomerResponse: - value: - autumn_id: "cus_2w5dzidzFD1cESxOGnn9frVuVcm" - created_at: 1677649423000 - env: "production" - id: "user_123" - name: "John Yeo" - email: "john@example.com" - fingerprint: "" - stripe_id: "cus_abc123" - products: - [ - { - id: "pro", - name: "Pro Plan", - group: "", - status: "active", - started_at: 1677649423000, - canceled_at: null, - current_period_start: 1677649423000, - current_period_end: 1680327823000, - }, - ] - features: - [ - { - feature_id: "messages", - unlimited: false, - interval: "month", - balance: 80, - usage: 20, - included_usage: 100, - next_reset_at: 1680327823000, - }, - ] - schemas: - CustomerProduct: - type: object - properties: - id: - type: string - name: - type: string - nullable: true - group: - type: string - nullable: true - status: - type: string - enum: [active, past_due, trialing] - started_at: - type: integer - format: int64 - canceled_at: - type: integer - format: int64 - nullable: true - current_period_start: - type: integer - format: int64 - nullable: true - current_period_end: - type: integer - format: int64 - nullable: true - CustomerFeature: - type: object - properties: - feature_id: - type: string - unlimited: - type: boolean - interval: - type: string - enum: [month, year] - nullable: true - balance: - type: integer - nullable: true - usage: - type: integer - nullable: true - included_usage: - type: integer - nullable: true - next_reset_at: - type: integer - format: int64 - nullable: true - Customer: - type: object - properties: - autumn_id: - type: string - description: Autumn's internal identifier for the customer - created_at: - type: integer - format: int64 - description: Timestamp of customer creation in milliseconds since epoch - env: - type: string - description: Environment the customer is in - enum: [production, sandbox] - id: - type: string - description: Your unique identifier for the customer - name: - type: string - description: Customer's name - email: - type: string - description: Customer's email address - fingerprint: - type: string - description: Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse - stripe_id: - type: string - description: Stripe customer ID - products: - type: array - description: List of products the customer has access to - items: - $ref: "#/components/schemas/CustomerProduct" - features: - type: array - description: List of features the customer has access to - items: - $ref: "#/components/schemas/CustomerFeature" - invoices: - type: array - description: Invoices for this customer (only included when expand=invoices) - items: - $ref: "#/components/schemas/Invoice" - Product: - type: object - properties: - id: - type: string - description: Unique identifier for the product - name: - type: string - description: Display name of the product - group: - type: string - description: Product grouping category - status: - type: string - enum: [active, past_due, trialing] - description: Current status of the product subscription. - created_at: - type: integer - format: int64 - description: Timestamp of product creation in milliseconds since epoch - canceled_at: - type: integer - format: int64 - nullable: true - description: Timestamp of cancellation, if applicable - processor: - type: object - properties: - type: - type: string - description: Payment processor type - subscription_id: - type: string - nullable: true - description: Payment processor's subscription ID - prices: - type: array - items: - type: object - properties: - amount: - type: number - description: Price amount in the default currency - interval: - type: string - enum: [month, year] - description: Billing interval for the price - Entitlement: - type: object - properties: - feature_id: - type: string - description: Unique identifier for the feature - interval: - type: string - description: Time interval for the entitlement - balance: - type: integer - nullable: true - description: Remaining balance of the entitlement - unlimited: - type: boolean - description: Whether the entitlement has unlimited usage - used: - type: integer - description: Amount of the entitlement that has been used - Invoice: - type: object - properties: - product_ids: - type: array - items: - type: string - description: List of product IDs included in this invoice - stripe_id: - type: string - description: Stripe invoice ID - status: - type: string - enum: [paid, unpaid, void] - description: Payment status of the invoice - total: - type: number - description: Total amount of the invoice - currency: - type: string - description: Currency code for the invoice - created_at: - type: integer - format: int64 - description: Timestamp of invoice creation in milliseconds since epoch - hosted_invoice_url: - type: string - format: uri - description: URL to view the hosted invoice page - securitySchemes: - bearerAuth: - type: http - scheme: bearer - publishableKeyAuthAttach: - type: http - scheme: bearer - description: You can use your Secret or Publishable key for this endpoint. Using your Publishable Key will always return a `checkout_url`. Using your Secret Key allows you to handle payments automatically (eg, for plan upgrades). - secretKeyAuth: - type: http - scheme: bearer - description: Your secret key must be used as the Bearer token for this endpoint. - publishableKeyAuthEntitled: - type: http - scheme: bearer - description: You can use your Secret or Publishable key for this endpoint. To include usage event tracking however, you must use your Secret key. diff --git a/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx b/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx index ebb7838a9..b122de129 100644 --- a/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx +++ b/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx @@ -98,33 +98,59 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The full plan object if expanded. - + + Unique identifier for the plan. + - + + Display name of the plan. + - + + Optional description of the plan. + - + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + - + + Version number of the plan. Incremented when plan configuration changes. + - + + Whether this is an add-on plan that can be attached alongside a main plan. + - + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + Base recurring price for the plan. Null for free plans or usage-only plans. - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + + Display text for showing this price in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + @@ -133,10 +159,14 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. - + + The ID of the feature this item configures. + + The full feature object if expanded. The ID of the feature, used to refer to it in other API calls like /track or /check. @@ -185,24 +215,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Number of free units included. For consumable features, balance resets to this number each interval. + - + + Whether the customer has unlimited access to this feature. + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. - + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + - + + Number of intervals between resets. Defaults to 1. + + Pricing configuration for usage beyond included units. Null if feature is entirely free. - + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. @@ -211,44 +254,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Billing interval for this price. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + - + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + - + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + Display text for showing this item in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + Rollover configuration for unused units. If set, unused included units roll over to the next period. - + + Maximum rollover units. Null for unlimited rollover. + - + + When rolled over units expire. + - - - - - - - - - - + + Number of periods before expiry. + @@ -257,31 +313,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Free trial configuration. If set, new customers can try this plan before being charged. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial duration ('day', 'month', 'year'). + - + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + - + + Unix timestamp (ms) when the plan was created. + - + + Environment this plan belongs to ('sandbox' or 'live'). + - + + Whether the plan is archived. Archived plans cannot be attached to new customers. + - - - - - - - - - + + If this is a variant, the ID of the base plan it was created from. @@ -344,33 +406,59 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The full plan object if expanded. - + + Unique identifier for the plan. + - + + Display name of the plan. + - + + Optional description of the plan. + - + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + - + + Version number of the plan. Incremented when plan configuration changes. + - + + Whether this is an add-on plan that can be attached alongside a main plan. + - + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + Base recurring price for the plan. Null for free plans or usage-only plans. - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + + Display text for showing this price in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + @@ -379,10 +467,14 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. - + + The ID of the feature this item configures. + + The full feature object if expanded. The ID of the feature, used to refer to it in other API calls like /track or /check. @@ -431,24 +523,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Number of free units included. For consumable features, balance resets to this number each interval. + - + + Whether the customer has unlimited access to this feature. + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. - + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + - + + Number of intervals between resets. Defaults to 1. + + Pricing configuration for usage beyond included units. Null if feature is entirely free. - + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. @@ -457,44 +562,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Billing interval for this price. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + - + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + - + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + Display text for showing this item in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + Rollover configuration for unused units. If set, unused included units roll over to the next period. - + + Maximum rollover units. Null for unlimited rollover. + - + + When rolled over units expire. + - - - - - - - - - - + + Number of periods before expiry. + @@ -503,31 +621,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Free trial configuration. If set, new customers can try this plan before being charged. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial duration ('day', 'month', 'year'). + - + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + - + + Unix timestamp (ms) when the plan was created. + - + + Environment this plan belongs to ('sandbox' or 'live'). + - + + Whether the plan is archived. Archived plans cannot be attached to new customers. + - - - - - - - - - + + If this is a variant, the ID of the base plan it was created from. diff --git a/apps/docs/mintlify/api-reference/customers/listCustomers.mdx b/apps/docs/mintlify/api-reference/customers/listCustomers.mdx index 904e4525a..f907f87fe 100644 --- a/apps/docs/mintlify/api-reference/customers/listCustomers.mdx +++ b/apps/docs/mintlify/api-reference/customers/listCustomers.mdx @@ -83,33 +83,59 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The full plan object if expanded. - + + Unique identifier for the plan. + - + + Display name of the plan. + - + + Optional description of the plan. + - + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + - + + Version number of the plan. Incremented when plan configuration changes. + - + + Whether this is an add-on plan that can be attached alongside a main plan. + - + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + Base recurring price for the plan. Null for free plans or usage-only plans. - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + + Display text for showing this price in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + @@ -118,10 +144,14 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. - + + The ID of the feature this item configures. + + The full feature object if expanded. The ID of the feature, used to refer to it in other API calls like /track or /check. @@ -170,24 +200,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Number of free units included. For consumable features, balance resets to this number each interval. + - + + Whether the customer has unlimited access to this feature. + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. - + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + - + + Number of intervals between resets. Defaults to 1. + + Pricing configuration for usage beyond included units. Null if feature is entirely free. - + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. @@ -196,44 +239,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Billing interval for this price. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + - + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + - + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + Display text for showing this item in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + Rollover configuration for unused units. If set, unused included units roll over to the next period. - + + Maximum rollover units. Null for unlimited rollover. + - + + When rolled over units expire. + - - - - - - - - - - + + Number of periods before expiry. + @@ -242,31 +298,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Free trial configuration. If set, new customers can try this plan before being charged. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial duration ('day', 'month', 'year'). + - + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + - + + Unix timestamp (ms) when the plan was created. + - + + Environment this plan belongs to ('sandbox' or 'live'). + - + + Whether the plan is archived. Archived plans cannot be attached to new customers. + - - - - - - - - - + + If this is a variant, the ID of the base plan it was created from. @@ -329,33 +391,59 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The full plan object if expanded. - + + Unique identifier for the plan. + - + + Display name of the plan. + - + + Optional description of the plan. + - + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + - + + Version number of the plan. Incremented when plan configuration changes. + - + + Whether this is an add-on plan that can be attached alongside a main plan. + - + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + Base recurring price for the plan. Null for free plans or usage-only plans. - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + + Display text for showing this price in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + @@ -364,10 +452,14 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. - + + The ID of the feature this item configures. + + The full feature object if expanded. The ID of the feature, used to refer to it in other API calls like /track or /check. @@ -416,24 +508,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Number of free units included. For consumable features, balance resets to this number each interval. + - + + Whether the customer has unlimited access to this feature. + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. - + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + - + + Number of intervals between resets. Defaults to 1. + + Pricing configuration for usage beyond included units. Null if feature is entirely free. - + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. @@ -442,44 +547,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Billing interval for this price. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + - + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + - + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + Display text for showing this item in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + Rollover configuration for unused units. If set, unused included units roll over to the next period. - + + Maximum rollover units. Null for unlimited rollover. + - + + When rolled over units expire. + - - - - - - - - - - + + Number of periods before expiry. + @@ -488,31 +606,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Free trial configuration. If set, new customers can try this plan before being charged. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial duration ('day', 'month', 'year'). + - + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + - + + Unix timestamp (ms) when the plan was created. + - + + Environment this plan belongs to ('sandbox' or 'live'). + - + + Whether the plan is archived. Archived plans cannot be attached to new customers. + - - - - - - - - - + + If this is a variant, the ID of the base plan it was created from. diff --git a/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx b/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx index 7b905dffc..2d91e2023 100644 --- a/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx +++ b/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx @@ -86,33 +86,59 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The full plan object if expanded. - + + Unique identifier for the plan. + - + + Display name of the plan. + - + + Optional description of the plan. + - + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + - + + Version number of the plan. Incremented when plan configuration changes. + - + + Whether this is an add-on plan that can be attached alongside a main plan. + - + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + Base recurring price for the plan. Null for free plans or usage-only plans. - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + + Display text for showing this price in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + @@ -121,10 +147,14 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. - + + The ID of the feature this item configures. + + The full feature object if expanded. The ID of the feature, used to refer to it in other API calls like /track or /check. @@ -173,24 +203,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Number of free units included. For consumable features, balance resets to this number each interval. + - + + Whether the customer has unlimited access to this feature. + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. - + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + - + + Number of intervals between resets. Defaults to 1. + + Pricing configuration for usage beyond included units. Null if feature is entirely free. - + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. @@ -199,44 +242,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Billing interval for this price. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + - + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + - + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + Display text for showing this item in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + Rollover configuration for unused units. If set, unused included units roll over to the next period. - + + Maximum rollover units. Null for unlimited rollover. + - + + When rolled over units expire. + - - - - - - - - - - + + Number of periods before expiry. + @@ -245,31 +301,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Free trial configuration. If set, new customers can try this plan before being charged. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial duration ('day', 'month', 'year'). + - + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + - + + Unix timestamp (ms) when the plan was created. + - + + Environment this plan belongs to ('sandbox' or 'live'). + - + + Whether the plan is archived. Archived plans cannot be attached to new customers. + - - - - - - - - - + + If this is a variant, the ID of the base plan it was created from. @@ -332,33 +394,59 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The full plan object if expanded. - + + Unique identifier for the plan. + - + + Display name of the plan. + - + + Optional description of the plan. + - + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + - + + Version number of the plan. Incremented when plan configuration changes. + - + + Whether this is an add-on plan that can be attached alongside a main plan. + - + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + Base recurring price for the plan. Null for free plans or usage-only plans. - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + + Display text for showing this price in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + @@ -367,10 +455,14 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. - + + The ID of the feature this item configures. + + The full feature object if expanded. The ID of the feature, used to refer to it in other API calls like /track or /check. @@ -419,24 +511,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Number of free units included. For consumable features, balance resets to this number each interval. + - + + Whether the customer has unlimited access to this feature. + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. - + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + - + + Number of intervals between resets. Defaults to 1. + + Pricing configuration for usage beyond included units. Null if feature is entirely free. - + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. @@ -445,44 +550,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Billing interval for this price. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + - + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + - + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + Display text for showing this item in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + Rollover configuration for unused units. If set, unused included units roll over to the next period. - + + Maximum rollover units. Null for unlimited rollover. + - + + When rolled over units expire. + - - - - - - - - - - + + Number of periods before expiry. + @@ -491,31 +609,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Free trial configuration. If set, new customers can try this plan before being charged. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial duration ('day', 'month', 'year'). + - + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + - + + Unix timestamp (ms) when the plan was created. + - + + Environment this plan belongs to ('sandbox' or 'live'). + - + + Whether the plan is archived. Archived plans cannot be attached to new customers. + - - - - - - - - - + + If this is a variant, the ID of the base plan it was created from. diff --git a/apps/docs/mintlify/api-reference/entities.yaml b/apps/docs/mintlify/api-reference/entities.yaml deleted file mode 100644 index 125551d35..000000000 --- a/apps/docs/mintlify/api-reference/entities.yaml +++ /dev/null @@ -1,337 +0,0 @@ -openapi: 3.0.0 -info: - title: Entities API - version: 1.0.0 -servers: - - url: https://api.useautumn.com/v1 -security: - - bearerAuth: [] -paths: - /customers/{customer_id}/entities: - post: - summary: Create a new entity - operationId: createEntity - security: - - bearerAuth: [] - parameters: - - name: customer_id - in: path - required: true - schema: - type: string - description: The unique identifier of the customer - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/CreateEntityRequest" - responses: - "201": - description: "" - x-code-samples: - - lang: typescript - label: single entity - source: | - import { Autumn as autumn } from 'autumn-js'; - - const entity = await autumn.entities.create('user_123', { - feature_id: 'seats', - id: 'seat_456', - name: 'Brandon Yeo' - }); - - - lang: typescript - label: multiple entities - source: | - import { Autumn as autumn } from 'autumn-js'; - - const entities = await autumn.entities.create('user_123', - [ - { - feature_id: 'seats', - id: 'seat_456', - name: 'Brandon Yeo' - }, - { - feature_id: 'seats', - id: 'seat_789', - name: 'John Yeo' - } - ]); - - - lang: curl - label: single entity - source: | - curl -X POST 'https://api.useautumn.com/v1/customers/user_123/entities' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '{ - "feature_id": "seats", - "id": "seat_456", - "name": "Brandon Yeo" - }' - - - lang: curl - label: multiple entities - source: | - curl -X POST 'https://api.useautumn.com/v1/customers/user_123/entities' \ - -H 'Authorization: Bearer am_sk_1234567890' \ - -H 'Content-Type: application/json' \ - -d '[ - { - "feature_id": "seats", - "id": "seat_456", - "name": "Brandon Yeo" - }, - { - "feature_id": "seats", - "id": "seat_789", - "name": "John Yeo" - }]' - - - lang: python - label: single entity - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn('am_sk_1234567890') - - async def main(): - entity = await autumn.entities.create( - customer_id='user_123', - id='seat_456', - feature_id='seats', - name='Brandon Yeo' - ) - - asyncio.run(main()) - - /customers/{customer_id}/entities/{entity_id}: - get: - summary: Get an entity - operationId: getEntity - security: - - bearerAuth: [] - parameters: - - name: customer_id - in: path - required: true - schema: - type: string - description: Your unique identifier for the customer - - name: entity_id - in: path - required: true - schema: - type: string - description: Your unique identifier of the entity (eg, a seat ID) - - name: expand - in: query - required: false - schema: - type: array - items: - type: string - enum: ["invoices"] - style: form - explode: false - description: Array of additional data to include in the entity response. Currently supports "invoices" - responses: - "200": - description: Entity retrieved successfully - content: - application/json: - schema: - $ref: "#/components/schemas/Entity" - "404": - description: Entity not found - x-code-samples: - - lang: typescript - source: | - const { data } = await autumn.entities.get('user_123', 'ent_1'); - - lang: python - source: | - entity = await autumn.entities.get(customer_id='user_123', entity_id='ent_1') - - lang: curl - source: | - curl -X GET 'https://api.useautumn.com/v1/customers/user_123/entities/ent_1' \ - -H 'Authorization: Bearer am_sk_1234567890' - - delete: - summary: Delete an entity - operationId: deleteEntity - security: - - bearerAuth: [] - parameters: - - name: customer_id - in: path - required: true - schema: - type: string - description: Your unique identifier for the customer - - name: entity_id - in: path - required: true - schema: - type: string - description: Your unique identifier of the entity (eg, a seat ID) - responses: - "200": - description: "" - x-code-samples: - - lang: typescript - source: | - await autumn.entities.delete(customer_id='user_123', entity_id='seat_456'); - - lang: python - source: | - import asyncio - from autumn import Autumn - - autumn = Autumn('am_sk_1234567890') - - async def main(): - await autumn.entities.delete(customer_id='user_123', entity_id='seat_456') - - asyncio.run(main()) - -components: - schemas: - CreateEntityRequest: - type: array - items: - type: object - required: - - id - - feature_id - - name - properties: - id: - type: string - description: Your unique identifier for the entity (eg, a seat ID) - feature_id: - type: string - description: The feature ID associated with this entity (eg, seats). When an entity is created, a usage event will be recorded for this feature. - name: - type: string - description: A name or identifier for the entity (e.g., an email address) - - Entity: - type: object - properties: - id: - type: string - description: The unique identifier of the entity - name: - type: string - description: The name of the entity - customer_id: - type: string - description: The customer ID this entity belongs to - created_at: - type: integer - format: int64 - description: Unix timestamp when the entity was created - env: - type: string - description: The environment (sandbox/live) - products: - type: array - items: - type: object - properties: - id: - type: string - name: - type: string - group: - type: string - nullable: true - status: - type: string - canceled_at: - type: integer - format: int64 - nullable: true - started_at: - type: integer - format: int64 - is_default: - type: boolean - is_add_on: - type: boolean - version: - type: integer - current_period_start: - type: integer - format: int64 - current_period_end: - type: integer - format: int64 - entity_id: - type: string - items: - type: array - items: - type: object - quantity: - type: integer - description: Products associated with this entity - features: - type: object - additionalProperties: - type: object - properties: - id: - type: string - type: - type: string - name: - type: string - interval: - type: string - interval_count: - type: integer - unlimited: - type: boolean - balance: - type: number - usage: - type: number - included_usage: - type: number - next_reset_at: - type: integer - format: int64 - overage_allowed: - type: boolean - description: Features associated with this entity - invoices: - type: array - items: - type: object - properties: - product_ids: - type: array - items: - type: string - stripe_id: - type: string - status: - type: string - total: - type: number - currency: - type: string - created_at: - type: integer - format: int64 - hosted_invoice_url: - type: string - description: Invoices for this entity (only included when expand=invoices) - - securitySchemes: - bearerAuth: - type: http - scheme: bearer \ No newline at end of file diff --git a/apps/docs/mintlify/api-reference/entities/createEntity.mdx b/apps/docs/mintlify/api-reference/entities/createEntity.mdx index e152536f4..a281c6d69 100644 --- a/apps/docs/mintlify/api-reference/entities/createEntity.mdx +++ b/apps/docs/mintlify/api-reference/entities/createEntity.mdx @@ -97,33 +97,59 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The full plan object if expanded. - + + Unique identifier for the plan. + - + + Display name of the plan. + - + + Optional description of the plan. + - + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + - + + Version number of the plan. Incremented when plan configuration changes. + - + + Whether this is an add-on plan that can be attached alongside a main plan. + - + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + Base recurring price for the plan. Null for free plans or usage-only plans. - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + + Display text for showing this price in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + @@ -132,10 +158,14 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. - + + The ID of the feature this item configures. + + The full feature object if expanded. The ID of the feature, used to refer to it in other API calls like /track or /check. @@ -184,24 +214,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Number of free units included. For consumable features, balance resets to this number each interval. + - + + Whether the customer has unlimited access to this feature. + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. - + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + - + + Number of intervals between resets. Defaults to 1. + + Pricing configuration for usage beyond included units. Null if feature is entirely free. - + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. @@ -210,44 +253,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Billing interval for this price. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + - + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + - + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + Display text for showing this item in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + Rollover configuration for unused units. If set, unused included units roll over to the next period. - + + Maximum rollover units. Null for unlimited rollover. + - + + When rolled over units expire. + - - - - - - - - - - + + Number of periods before expiry. + @@ -256,31 +312,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Free trial configuration. If set, new customers can try this plan before being charged. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial duration ('day', 'month', 'year'). + - + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + - + + Unix timestamp (ms) when the plan was created. + - + + Environment this plan belongs to ('sandbox' or 'live'). + - + + Whether the plan is archived. Archived plans cannot be attached to new customers. + - - - - - - - - - + + If this is a variant, the ID of the base plan it was created from. @@ -342,33 +404,59 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The full plan object if expanded. - + + Unique identifier for the plan. + - + + Display name of the plan. + - + + Optional description of the plan. + - + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + - + + Version number of the plan. Incremented when plan configuration changes. + - + + Whether this is an add-on plan that can be attached alongside a main plan. + - + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + Base recurring price for the plan. Null for free plans or usage-only plans. - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + + Display text for showing this price in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + @@ -377,10 +465,14 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. - + + The ID of the feature this item configures. + + The full feature object if expanded. The ID of the feature, used to refer to it in other API calls like /track or /check. @@ -429,24 +521,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Number of free units included. For consumable features, balance resets to this number each interval. + - + + Whether the customer has unlimited access to this feature. + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. - + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + - + + Number of intervals between resets. Defaults to 1. + + Pricing configuration for usage beyond included units. Null if feature is entirely free. - + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. @@ -455,44 +560,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Billing interval for this price. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + - + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + - + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + Display text for showing this item in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + Rollover configuration for unused units. If set, unused included units roll over to the next period. - + + Maximum rollover units. Null for unlimited rollover. + - + + When rolled over units expire. + - - - - - - - - - - + + Number of periods before expiry. + @@ -501,31 +619,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Free trial configuration. If set, new customers can try this plan before being charged. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial duration ('day', 'month', 'year'). + - + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + - + + Unix timestamp (ms) when the plan was created. + - + + Environment this plan belongs to ('sandbox' or 'live'). + - + + Whether the plan is archived. Archived plans cannot be attached to new customers. + - - - - - - - - - + + If this is a variant, the ID of the base plan it was created from. diff --git a/apps/docs/mintlify/api-reference/entities/getEntity.mdx b/apps/docs/mintlify/api-reference/entities/getEntity.mdx index 4e660bfb2..39c031640 100644 --- a/apps/docs/mintlify/api-reference/entities/getEntity.mdx +++ b/apps/docs/mintlify/api-reference/entities/getEntity.mdx @@ -51,33 +51,59 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The full plan object if expanded. - + + Unique identifier for the plan. + - + + Display name of the plan. + - + + Optional description of the plan. + - + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + - + + Version number of the plan. Incremented when plan configuration changes. + - + + Whether this is an add-on plan that can be attached alongside a main plan. + - + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + Base recurring price for the plan. Null for free plans or usage-only plans. - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + + Display text for showing this price in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + @@ -86,10 +112,14 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. - + + The ID of the feature this item configures. + + The full feature object if expanded. The ID of the feature, used to refer to it in other API calls like /track or /check. @@ -138,24 +168,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Number of free units included. For consumable features, balance resets to this number each interval. + - + + Whether the customer has unlimited access to this feature. + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. - + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + - + + Number of intervals between resets. Defaults to 1. + + Pricing configuration for usage beyond included units. Null if feature is entirely free. - + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. @@ -164,44 +207,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Billing interval for this price. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + - + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + - + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + Display text for showing this item in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + Rollover configuration for unused units. If set, unused included units roll over to the next period. - + + Maximum rollover units. Null for unlimited rollover. + - + + When rolled over units expire. + - - - - - - - - - - + + Number of periods before expiry. + @@ -210,31 +266,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Free trial configuration. If set, new customers can try this plan before being charged. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial duration ('day', 'month', 'year'). + - + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + - + + Unix timestamp (ms) when the plan was created. + - + + Environment this plan belongs to ('sandbox' or 'live'). + - + + Whether the plan is archived. Archived plans cannot be attached to new customers. + - - - - - - - - - + + If this is a variant, the ID of the base plan it was created from. @@ -296,33 +358,59 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The full plan object if expanded. - + + Unique identifier for the plan. + - + + Display name of the plan. + - + + Optional description of the plan. + - + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + - + + Version number of the plan. Incremented when plan configuration changes. + - + + Whether this is an add-on plan that can be attached alongside a main plan. + - + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + Base recurring price for the plan. Null for free plans or usage-only plans. - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + + Display text for showing this price in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + @@ -331,10 +419,14 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. - + + The ID of the feature this item configures. + + The full feature object if expanded. The ID of the feature, used to refer to it in other API calls like /track or /check. @@ -383,24 +475,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Number of free units included. For consumable features, balance resets to this number each interval. + - + + Whether the customer has unlimited access to this feature. + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. - + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + - + + Number of intervals between resets. Defaults to 1. + + Pricing configuration for usage beyond included units. Null if feature is entirely free. - + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. @@ -409,44 +514,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Billing interval for this price. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + - + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + - + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + Display text for showing this item in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + Rollover configuration for unused units. If set, unused included units roll over to the next period. - + + Maximum rollover units. Null for unlimited rollover. + - + + When rolled over units expire. + - - - - - - - - - - + + Number of periods before expiry. + @@ -455,31 +573,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Free trial configuration. If set, new customers can try this plan before being charged. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial duration ('day', 'month', 'year'). + - + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + - + + Unix timestamp (ms) when the plan was created. + - + + Environment this plan belongs to ('sandbox' or 'live'). + - + + Whether the plan is archived. Archived plans cannot be attached to new customers. + - - - - - - - - - + + If this is a variant, the ID of the base plan it was created from. diff --git a/apps/docs/mintlify/api-reference/plans/createPlan.mdx b/apps/docs/mintlify/api-reference/plans/createPlan.mdx new file mode 100644 index 000000000..b595a61a8 --- /dev/null +++ b/apps/docs/mintlify/api-reference/plans/createPlan.mdx @@ -0,0 +1,620 @@ +--- +title: "Create a plan" +openapi: "openapi POST /v1/plans.create" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +Creates a new plan with optional base price and feature configurations. See [How plans work](/documentation/pricing/plans) for concepts and [Adding features to plans](/documentation/pricing/plan-features) for item configuration. + +### Plan Configuration + +A plan consists of: +- **Base price** - optional recurring charge for the plan itself +- **Items** - feature configurations defining what customers get and how they're billed + +### Configuring Items + +Each item in the `items` array configures a single feature. There are two types: + +**Consumable features** (API calls, messages, credits): +- Set `included` for free units that reset each period +- Set `reset.interval` to define when balance resets to `included` +- Optionally add `price` for usage beyond included amount + +**Non-consumable features** (seats, storage): +- Set `included` for the base allocation +- Do NOT set `reset` - usage persists across billing cycles +- Use `billing_method: "prepaid"` for upfront payment per unit + +### Common Use Cases + + + +```typescript Free plan with auto-enable +await autumn.plans.create({ + planId: "free_plan", + name: "Free", + autoEnable: true, // Automatically attached on customer creation + items: [ + { + featureId: "messages", + included: 100, + reset: { interval: "month" } + } + ] +}); +``` + +```typescript Paid plan with base price + usage-based feature +await autumn.plans.create({ + planId: "pro_plan", + name: "Pro Plan", + price: { amount: 10, interval: "month" }, + items: [ + { + featureId: "messages", + included: 1000, + reset: { interval: "month" }, + price: { + amount: 0.01, + interval: "month", + billingUnits: 1, + billingMethod: "usage_based" + } + } + ] +}); +``` + +```typescript Plan with prepaid seats +await autumn.plans.create({ + planId: "team_plan", + name: "Team Plan", + price: { amount: 49, interval: "month" }, + items: [ + { + featureId: "seats", + included: 5, + // No reset - seats persist across billing cycles + price: { + amount: 10, + interval: "month", + billingUnits: 1, + billingMethod: "prepaid" + } + } + ] +}); +``` + +```typescript Add-on plan +await autumn.plans.create({ + planId: "analytics_addon", + name: "Advanced Analytics", + addOn: true, // Can be attached alongside other plans + price: { amount: 20, interval: "month" } +}); +``` + +```typescript Plan with tiered pricing +await autumn.plans.create({ + planId: "api_plan", + name: "API Plan", + items: [ + { + featureId: "api_calls", + included: 1000, + reset: { interval: "month" }, + price: { + tiers: [ + { to: 10000, amount: 0.001 }, + { to: 100000, amount: 0.0005 }, + { to: "inf", amount: 0.0001 } + ], + interval: "month", + billingUnits: 1, + billingMethod: "usage_based" + } + } + ] +}); +``` + +```typescript Plan with free trial +await autumn.plans.create({ + planId: "premium_plan", + name: "Premium", + price: { amount: 99, interval: "month" }, + freeTrial: { + durationLength: 14, + durationType: "day", + cardRequired: true + } +}); +``` + + + +### Body Parameters + + + The ID of the plan to create. + + + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + + + + Display name of the plan. + + + + Optional description of the plan. + + + + If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. + + + + If true, plan is automatically attached when a customer is created. Use for free tiers. + + + + Base recurring price for the plan. Omit for free or usage-only plans. + + + Base price amount for the plan. + + + + Billing interval (e.g. 'month', 'year'). + + + + Number of intervals per billing cycle. Defaults to 1. + + + + + + + Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. + + + The ID of the feature to configure. + + + + Number of free units included. Balance resets to this each interval for consumable features. + + + + If true, customer has unlimited access to this feature. + + + + Reset configuration for consumable features. Omit for non-consumable features like seats. + + + Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + + + + Number of intervals between resets. Defaults to 1. + + + + + + + Pricing for usage beyond included units. Omit for free features. + + + Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + + + + Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + + + + + + + + + + Billing interval. For consumable features, should match reset.interval. + + + + Number of intervals per billing cycle. Defaults to 1. + + + + Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + + + + 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + + + + Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + + + + + + + Proration settings for prepaid features. Controls mid-cycle quantity change billing. + + + Billing behavior when quantity increases mid-cycle. + + + + Credit behavior when quantity decreases mid-cycle. + + + + + + + Rollover config for unused units. If set, unused included units carry over. + + + Max rollover units. Omit for unlimited rollover. + + + + When rolled over units expire. + + + + Number of periods before expiry. + + + + + + + + + + Free trial configuration. Customers can try this plan before being charged. + + + Number of duration_type periods the trial lasts. + + + + Unit of time for the trial ('day', 'month', 'year'). + + + + If true, payment method required to start trial. Customer is charged after trial ends. + + + + + + +### Response + + + Unique identifier for the plan. + + + + Display name of the plan. + + + + Optional description of the plan. + + + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + + + + Version number of the plan. Incremented when plan configuration changes. + + + + Whether this is an add-on plan that can be attached alongside a main plan. + + + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + + + Base recurring price for the plan. Null for free plans or usage-only plans. + + + Base price amount for the plan. + + + + Billing interval (e.g. 'month', 'year'). + + + + Number of intervals per billing cycle. Defaults to 1. + + + + Display text for showing this price in pricing pages. + + + Main display text (e.g. '$10' or '100 messages'). + + + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + + + + + + + + + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. + + + The ID of the feature this item configures. + + + + The full feature object if expanded. + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + + + Number of free units included. For consumable features, balance resets to this number each interval. + + + + Whether the customer has unlimited access to this feature. + + + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. + + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + + + + Number of intervals between resets. Defaults to 1. + + + + + + + Pricing configuration for usage beyond included units. Null if feature is entirely free. + + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + + + + + + + + + + Billing interval for this price. For consumable features, should match reset.interval. + + + + Number of intervals per billing cycle. Defaults to 1. + + + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + + + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + + + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + + + + + + Display text for showing this item in pricing pages. + + + Main display text (e.g. '$10' or '100 messages'). + + + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + + + + + + Rollover configuration for unused units. If set, unused included units roll over to the next period. + + + Maximum rollover units. Null for unlimited rollover. + + + + When rolled over units expire. + + + + Number of periods before expiry. + + + + + + + + + + Free trial configuration. If set, new customers can try this plan before being charged. + + + Number of duration_type periods the trial lasts. + + + + Unit of time for the trial duration ('day', 'month', 'year'). + + + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + + + + + + + Unix timestamp (ms) when the plan was created. + + + + Environment this plan belongs to ('sandbox' or 'live'). + + + + Whether the plan is archived. Archived plans cannot be attached to new customers. + + + + If this is a variant, the ID of the base plan it was created from. + + + + +```json 200 +{ + "id": "pro", + "name": "Pro Plan", + "description": null, + "group": null, + "version": 1, + "addOn": false, + "autoEnable": false, + "price": { + "amount": 10, + "interval": "month", + "display": { + "primaryText": "$10", + "secondaryText": "per month" + } + }, + "items": [ + { + "featureId": "messages", + "included": 100, + "unlimited": false, + "reset": { + "interval": "month" + }, + "price": { + "amount": 0.5, + "interval": "month", + "billingUnits": 100, + "billingMethod": "usage_based", + "maxPurchase": null + }, + "display": { + "primaryText": "100 messages", + "secondaryText": "then $0.5 per 100 messages" + } + }, + { + "featureId": "users", + "included": 0, + "unlimited": false, + "reset": null, + "price": { + "amount": 10, + "interval": "month", + "billingUnits": 1, + "billingMethod": "prepaid", + "maxPurchase": null + }, + "display": { + "primaryText": "$10 per Users" + } + } + ], + "createdAt": 1771513979217, + "env": "sandbox", + "archived": false, + "baseVariantId": null +} +``` + diff --git a/apps/docs/mintlify/api-reference/plans/deletePlan.mdx b/apps/docs/mintlify/api-reference/plans/deletePlan.mdx new file mode 100644 index 000000000..e0e8f9b34 --- /dev/null +++ b/apps/docs/mintlify/api-reference/plans/deletePlan.mdx @@ -0,0 +1,48 @@ +--- +title: "Delete a plan" +openapi: "openapi POST /v1/plans.delete" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +Deletes a plan or a specific version of a plan. + + + Deleting a plan cannot be undone. Existing subscriptions to this plan will remain active until canceled. + + +### Common Use Cases + + + +```typescript Delete latest version +await autumn.plans.delete({ + planId: "old_plan" +}); +``` + +```typescript Delete all versions +await autumn.plans.delete({ + planId: "old_plan", + allVersions: true +}); +``` + + + +### Body Parameters + + + The ID of the plan to delete. + + + + If true, deletes all versions of the plan. Otherwise, only deletes the latest version. + + + +### Response + + diff --git a/apps/docs/mintlify/api-reference/plans/getPlan.mdx b/apps/docs/mintlify/api-reference/plans/getPlan.mdx new file mode 100644 index 000000000..48253aa2c --- /dev/null +++ b/apps/docs/mintlify/api-reference/plans/getPlan.mdx @@ -0,0 +1,354 @@ +--- +title: "Get a plan" +openapi: "openapi POST /v1/plans.get" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +Retrieves a single plan by its ID. Returns the latest version by default. + +### Common Use Cases + + + +```typescript Get a plan +const plan = await autumn.plans.get({ + planId: "pro_plan" +}); +``` + +```typescript Get a specific version +const plan = await autumn.plans.get({ + planId: "pro_plan", + version: 2 +}); +``` + + + +### Body Parameters + + + The ID of the plan to retrieve. + + + + The version of the plan to get. Defaults to the latest version. + + + +### Response + + + Unique identifier for the plan. + + + + Display name of the plan. + + + + Optional description of the plan. + + + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + + + + Version number of the plan. Incremented when plan configuration changes. + + + + Whether this is an add-on plan that can be attached alongside a main plan. + + + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + + + Base recurring price for the plan. Null for free plans or usage-only plans. + + + Base price amount for the plan. + + + + Billing interval (e.g. 'month', 'year'). + + + + Number of intervals per billing cycle. Defaults to 1. + + + + Display text for showing this price in pricing pages. + + + Main display text (e.g. '$10' or '100 messages'). + + + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + + + + + + + + + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. + + + The ID of the feature this item configures. + + + + The full feature object if expanded. + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + + + Number of free units included. For consumable features, balance resets to this number each interval. + + + + Whether the customer has unlimited access to this feature. + + + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. + + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + + + + Number of intervals between resets. Defaults to 1. + + + + + + + Pricing configuration for usage beyond included units. Null if feature is entirely free. + + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + + + + + + + + + + Billing interval for this price. For consumable features, should match reset.interval. + + + + Number of intervals per billing cycle. Defaults to 1. + + + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + + + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + + + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + + + + + + Display text for showing this item in pricing pages. + + + Main display text (e.g. '$10' or '100 messages'). + + + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + + + + + + Rollover configuration for unused units. If set, unused included units roll over to the next period. + + + Maximum rollover units. Null for unlimited rollover. + + + + When rolled over units expire. + + + + Number of periods before expiry. + + + + + + + + + + Free trial configuration. If set, new customers can try this plan before being charged. + + + Number of duration_type periods the trial lasts. + + + + Unit of time for the trial duration ('day', 'month', 'year'). + + + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + + + + + + + Unix timestamp (ms) when the plan was created. + + + + Environment this plan belongs to ('sandbox' or 'live'). + + + + Whether the plan is archived. Archived plans cannot be attached to new customers. + + + + If this is a variant, the ID of the base plan it was created from. + + + + +```json 200 +{ + "id": "pro", + "name": "Pro Plan", + "description": null, + "group": null, + "version": 1, + "addOn": false, + "autoEnable": false, + "price": { + "amount": 10, + "interval": "month", + "display": { + "primaryText": "$10", + "secondaryText": "per month" + } + }, + "items": [ + { + "featureId": "messages", + "included": 100, + "unlimited": false, + "reset": { + "interval": "month" + }, + "price": { + "amount": 0.5, + "interval": "month", + "billingUnits": 100, + "billingMethod": "usage_based", + "maxPurchase": null + }, + "display": { + "primaryText": "100 messages", + "secondaryText": "then $0.5 per 100 messages" + } + }, + { + "featureId": "users", + "included": 0, + "unlimited": false, + "reset": null, + "price": { + "amount": 10, + "interval": "month", + "billingUnits": 1, + "billingMethod": "prepaid", + "maxPurchase": null + }, + "display": { + "primaryText": "$10 per Users" + } + } + ], + "createdAt": 1771513979217, + "env": "sandbox", + "archived": false, + "baseVariantId": null +} +``` + diff --git a/apps/docs/mintlify/api-reference/plans/list.mdx b/apps/docs/mintlify/api-reference/plans/list.mdx deleted file mode 100644 index c85ac43b7..000000000 --- a/apps/docs/mintlify/api-reference/plans/list.mdx +++ /dev/null @@ -1,202 +0,0 @@ ---- -title: "List Plans" -openapi: "openapi GET /v1/plans.list" ---- - -import { DynamicParamField } from "/components/dynamic-param-field.jsx"; -import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; -import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; - - -### Response - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The ID of the feature, used to refer to it in other API calls like /track or /check. - - - - The name of the feature. - - - - The type of the feature - - - - Singular and plural display names for the feature. - - - The singular display name for the feature. - - - - The plural display name for the feature. - - - - - - - Credit cost schema for credit system features. - - - The ID of the metered feature (should be a single_use feature). - - - - The credit cost of the metered feature. - - - - - - - Whether or not the feature is archived. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/docs/mintlify/api-reference/plans/listPlans.mdx b/apps/docs/mintlify/api-reference/plans/listPlans.mdx index 9ada1eef0..b4d600a6e 100644 --- a/apps/docs/mintlify/api-reference/plans/listPlans.mdx +++ b/apps/docs/mintlify/api-reference/plans/listPlans.mdx @@ -7,46 +7,110 @@ import { DynamicParamField } from "/components/dynamic-param-field.jsx"; import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; +Lists all plans in the current environment. + + + Pass a `customer_id` to include customer-specific eligibility info like whether a free trial is available and the attach scenario (new, upgrade, downgrade). + + +### Common Use Cases + + + +```typescript List all plans +const plans = await autumn.plans.list(); +``` + +```typescript List plans with customer eligibility +const plans = await autumn.plans.list({ + customerId: "cus_123" +}); + +// Each plan will include customerEligibility: +// - trialAvailable: whether customer can use the trial +// - scenario: 'new', 'upgrade', 'downgrade', etc. +``` + +```typescript Include archived plans +const plans = await autumn.plans.list({ + includeArchived: true +}); +``` + + + ### Body Parameters - + + Customer ID to include eligibility info (trial availability, attach scenario). + - + + Entity ID for entity-scoped plans. + - + + If true, includes archived plans in the response. + ### Response - + + Unique identifier for the plan. + - + + Display name of the plan. + - + + Optional description of the plan. + - + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + - + + Version number of the plan. Incremented when plan configuration changes. + - + + Whether this is an add-on plan that can be attached alongside a main plan. + - + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + Base recurring price for the plan. Null for free plans or usage-only plans. - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + + Display text for showing this price in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + @@ -55,10 +119,14 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. - + + The ID of the feature this item configures. + + The full feature object if expanded. The ID of the feature, used to refer to it in other API calls like /track or /check. @@ -107,24 +175,37 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Number of free units included. For consumable features, balance resets to this number each interval. + - + + Whether the customer has unlimited access to this feature. + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. - + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + - + + Number of intervals between resets. Defaults to 1. + + Pricing configuration for usage beyond included units. Null if feature is entirely free. - + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. @@ -133,44 +214,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Billing interval for this price. For consumable features, should match reset.interval. + - + + Number of intervals per billing cycle. Defaults to 1. + - + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + - + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + - + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + Display text for showing this item in pricing pages. - + + Main display text (e.g. '$10' or '100 messages'). + - + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + Rollover configuration for unused units. If set, unused included units roll over to the next period. - + + Maximum rollover units. Null for unlimited rollover. + - + + When rolled over units expire. + - - - - - - - - - - + + Number of periods before expiry. + @@ -179,32 +273,106 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Free trial configuration. If set, new customers can try this plan before being charged. - + + Number of duration_type periods the trial lasts. + - + + Unit of time for the trial duration ('day', 'month', 'year'). + - + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + - + + Unix timestamp (ms) when the plan was created. + - + + Environment this plan belongs to ('sandbox' or 'live'). + - + + Whether the plan is archived. Archived plans cannot be attached to new customers. + - - - - - - - - - + + If this is a variant, the ID of the base plan it was created from. + + + +```json 200 +{ + "list": [ + { + "id": "pro", + "name": "Pro Plan", + "description": null, + "group": null, + "version": 1, + "addOn": false, + "autoEnable": false, + "price": { + "amount": 10, + "interval": "month", + "display": { + "primaryText": "$10", + "secondaryText": "per month" + } + }, + "items": [ + { + "featureId": "messages", + "included": 100, + "unlimited": false, + "reset": { + "interval": "month" + }, + "price": { + "amount": 0.5, + "interval": "month", + "billingUnits": 100, + "billingMethod": "usage_based", + "maxPurchase": null + }, + "display": { + "primaryText": "100 messages", + "secondaryText": "then $0.5 per 100 messages" + } + }, + { + "featureId": "users", + "included": 0, + "unlimited": false, + "reset": null, + "price": { + "amount": 10, + "interval": "month", + "billingUnits": 1, + "billingMethod": "prepaid", + "maxPurchase": null + }, + "display": { + "primaryText": "$10 per Users" + } + } + ], + "createdAt": 1771513979217, + "env": "sandbox", + "archived": false, + "baseVariantId": null + } + ] +} +``` + diff --git a/apps/docs/mintlify/api-reference/plans/updatePlan.mdx b/apps/docs/mintlify/api-reference/plans/updatePlan.mdx new file mode 100644 index 000000000..43684a77f --- /dev/null +++ b/apps/docs/mintlify/api-reference/plans/updatePlan.mdx @@ -0,0 +1,555 @@ +--- +title: "Update a plan" +openapi: "openapi POST /v1/plans.update" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +Updates an existing plan. By default, creates a new version of the plan. See [Adding features to plans](/documentation/pricing/plan-features) for item configuration. + + + Updates create a new plan version by default. Existing customers remain on their current version until their subscription renews or they explicitly upgrade. + + +### Updating Items + +When updating `items`, you must provide the complete items array. The new array replaces the existing configuration entirely. + +To update a single feature's configuration while keeping others unchanged, include all existing items with the modified values. + +### Common Use Cases + + + +```typescript Update plan price +await autumn.plans.update({ + planId: "pro_plan", + price: { amount: 15, interval: "month" } +}); +``` + +```typescript Remove base price (usage-only plan) +await autumn.plans.update({ + planId: "pro_plan", + price: null // Removes the base price +}); +``` + +```typescript Update feature's included amount +await autumn.plans.update({ + planId: "pro_plan", + items: [ + { + featureId: "messages", + included: 2000, // Increased from 1000 + reset: { interval: "month" } + } + ] +}); +``` + +```typescript Archive a plan +await autumn.plans.update({ + planId: "old_plan", + archived: true +}); +``` + +```typescript Rename a plan +await autumn.plans.update({ + planId: "pro_plan", + name: "Pro Plan (Updated)", + newPlanId: "pro_plan_v2" // Optional: change the plan ID +}); +``` + + + +### Body Parameters + + + The ID of the plan to update. + + + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + + + + Display name of the plan. + + + + + + Whether the plan is an add-on. + + + + Whether the plan is automatically enabled. + + + + The price of the plan. Set to null to remove the base price. + + + Base price amount for the plan. + + + + Billing interval (e.g. 'month', 'year'). + + + + Number of intervals per billing cycle. Defaults to 1. + + + + + + + Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. + + + The ID of the feature to configure. + + + + Number of free units included. Balance resets to this each interval for consumable features. + + + + If true, customer has unlimited access to this feature. + + + + Reset configuration for consumable features. Omit for non-consumable features like seats. + + + Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + + + + Number of intervals between resets. Defaults to 1. + + + + + + + Pricing for usage beyond included units. Omit for free features. + + + Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + + + + Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + + + + + + + + + + Billing interval. For consumable features, should match reset.interval. + + + + Number of intervals per billing cycle. Defaults to 1. + + + + Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + + + + 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + + + + Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + + + + + + + Proration settings for prepaid features. Controls mid-cycle quantity change billing. + + + Billing behavior when quantity increases mid-cycle. + + + + Credit behavior when quantity decreases mid-cycle. + + + + + + + Rollover config for unused units. If set, unused included units carry over. + + + Max rollover units. Omit for unlimited rollover. + + + + When rolled over units expire. + + + + Number of periods before expiry. + + + + + + + + + + The free trial of the plan. Set to null to remove the free trial. + + + Number of duration_type periods the trial lasts. + + + + Unit of time for the trial ('day', 'month', 'year'). + + + + If true, payment method required to start trial. Customer is charged after trial ends. + + + + + + + + + + + The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. + + + +### Response + + + Unique identifier for the plan. + + + + Display name of the plan. + + + + Optional description of the plan. + + + + Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + + + + Version number of the plan. Incremented when plan configuration changes. + + + + Whether this is an add-on plan that can be attached alongside a main plan. + + + + If true, this plan is automatically attached when a customer is created. Used for free plans. + + + + Base recurring price for the plan. Null for free plans or usage-only plans. + + + Base price amount for the plan. + + + + Billing interval (e.g. 'month', 'year'). + + + + Number of intervals per billing cycle. Defaults to 1. + + + + Display text for showing this price in pricing pages. + + + Main display text (e.g. '$10' or '100 messages'). + + + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + + + + + + + + + Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. + + + The ID of the feature this item configures. + + + + The full feature object if expanded. + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + + + Number of free units included. For consumable features, balance resets to this number each interval. + + + + Whether the customer has unlimited access to this feature. + + + + Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. + + + The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + + + + Number of intervals between resets. Defaults to 1. + + + + + + + Pricing configuration for usage beyond included units. Null if feature is entirely free. + + + Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + + + + Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + + + + + + + + + + Billing interval for this price. For consumable features, should match reset.interval. + + + + Number of intervals per billing cycle. Defaults to 1. + + + + Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + + + + 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + + + + Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + + + + + + + Display text for showing this item in pricing pages. + + + Main display text (e.g. '$10' or '100 messages'). + + + + Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + + + + + + + Rollover configuration for unused units. If set, unused included units roll over to the next period. + + + Maximum rollover units. Null for unlimited rollover. + + + + When rolled over units expire. + + + + Number of periods before expiry. + + + + + + + + + + Free trial configuration. If set, new customers can try this plan before being charged. + + + Number of duration_type periods the trial lasts. + + + + Unit of time for the trial duration ('day', 'month', 'year'). + + + + Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + + + + + + + Unix timestamp (ms) when the plan was created. + + + + Environment this plan belongs to ('sandbox' or 'live'). + + + + Whether the plan is archived. Archived plans cannot be attached to new customers. + + + + If this is a variant, the ID of the base plan it was created from. + + + + +```json 200 +{ + "id": "pro", + "name": "Pro Plan", + "description": null, + "group": null, + "version": 1, + "addOn": false, + "autoEnable": false, + "price": { + "amount": 10, + "interval": "month", + "display": { + "primaryText": "$10", + "secondaryText": "per month" + } + }, + "items": [ + { + "featureId": "messages", + "included": 100, + "unlimited": false, + "reset": { + "interval": "month" + }, + "price": { + "amount": 0.5, + "interval": "month", + "billingUnits": 100, + "billingMethod": "usage_based", + "maxPurchase": null + }, + "display": { + "primaryText": "100 messages", + "secondaryText": "then $0.5 per 100 messages" + } + }, + { + "featureId": "users", + "included": 0, + "unlimited": false, + "reset": null, + "price": { + "amount": 10, + "interval": "month", + "billingUnits": 1, + "billingMethod": "prepaid", + "maxPurchase": null + }, + "display": { + "primaryText": "$10 per Users" + } + } + ], + "createdAt": 1771513979217, + "env": "sandbox", + "archived": false, + "baseVariantId": null +} +``` + diff --git a/apps/docs/mintlify/api-reference/products/create-product.mdx b/apps/docs/mintlify/api-reference/products/create-product.mdx deleted file mode 100644 index b05714802..000000000 --- a/apps/docs/mintlify/api-reference/products/create-product.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "Create Product" -openapi: "openapi-1.2.0 POST /products" ---- diff --git a/apps/docs/mintlify/api-reference/products/delete-product.mdx b/apps/docs/mintlify/api-reference/products/delete-product.mdx deleted file mode 100644 index 6c92f3d69..000000000 --- a/apps/docs/mintlify/api-reference/products/delete-product.mdx +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: "Delete Product" -openapi: "openapi-1.2.0 DELETE /products/{product_id}" ---- - - -If the product has been attached to a customer before, then it cannot be deleted, and an error will be returned. - - -By default the latest version of that product is deleted. To delete all versions pass in the `all_versions` query parameter. diff --git a/apps/docs/mintlify/api-reference/products/get-product.mdx b/apps/docs/mintlify/api-reference/products/get-product.mdx deleted file mode 100644 index b0d1a7921..000000000 --- a/apps/docs/mintlify/api-reference/products/get-product.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "Get Product" -openapi: "openapi-1.2.0 GET /products/{product_id}" ---- diff --git a/apps/docs/mintlify/api-reference/products/list-products.mdx b/apps/docs/mintlify/api-reference/products/list-products.mdx deleted file mode 100644 index 360ad0b10..000000000 --- a/apps/docs/mintlify/api-reference/products/list-products.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "List Products" -openapi: "openapi-1.2.0 GET /products" ---- diff --git a/apps/docs/mintlify/api-reference/products/update-product.mdx b/apps/docs/mintlify/api-reference/products/update-product.mdx deleted file mode 100644 index e6cbfe143..000000000 --- a/apps/docs/mintlify/api-reference/products/update-product.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "Update Product" -openapi: "openapi-1.2.0 POST /products/{product_id}" ---- diff --git a/apps/docs/mintlify/api-reference/productsapi.json b/apps/docs/mintlify/api-reference/productsapi.json deleted file mode 100644 index d5b4eda39..000000000 --- a/apps/docs/mintlify/api-reference/productsapi.json +++ /dev/null @@ -1,572 +0,0 @@ -{ - "openapi": "3.0.0", - "info": { - "title": "Product API", - "version": "1.0.0" - }, - "servers": [ - { - "url": "https://api.useautumn.com/v1" - } - ], - "security": [ - { - "bearerAuth": [] - } - ], - "paths": { - "/products": { - "post": { - "summary": "Create a new product", - "operationId": "createProduct", - "security": [ - { - "bearerAuth": [] - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateProductRequest" - } - } - } - }, - "responses": { - "201": { - "description": "Product created successfully", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Product" - } - } - } - } - } - }, - "get": { - "summary": "List all products", - "operationId": "listProducts", - "security": [ - { - "bearerAuth": [] - } - ], - "responses": { - "200": { - "description": "Products retrieved successfully", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Product" - } - } - } - } - } - } - } - }, - "/products/{product_id}": { - "get": { - "summary": "Get a product by ID", - "operationId": "getProduct", - "security": [ - { - "bearerAuth": [] - } - ], - "parameters": [ - { - "name": "product_id", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "description": "The product ID defined when creating the product " - } - ], - "responses": { - "200": { - "description": "Product retrieved successfully", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Product" - } - } - } - }, - "404": { - "description": "Product not found" - } - } - }, - "post": { - "summary": "Update a product", - "operationId": "updateProduct", - "security": [ - { - "bearerAuth": [] - } - ], - "parameters": [ - { - "name": "product_id", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "description": "The product ID of the product to update" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "id": { - "type": "string", - "pattern": "^[a-zA-Z0-9_-]+$", - "description": "Update the product ID" - }, - "name": { - "type": "string", - "description": "The name of the product" - }, - "is_add_on": { - "type": "boolean", - "description": "Whether the product is an add-on" - }, - "is_default": { - "type": "boolean", - "description": "Whether the product is the default product" - }, - "version": { - "type": "number", - "description": "The version number for this product" - }, - "group": { - "type": "string", - "nullable": true, - "description": "The product group this belongs to" - }, - "archived": { - "type": "boolean", - "description": "Whether to archive this product" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ProductItem" - }, - "description": "Array of product items that define features and pricing" - }, - "free_trial": { - "$ref": "#/components/schemas/FreeTrial" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Product updated successfully", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Product" - } - } - } - }, - "404": { - "description": "Product not found" - } - } - }, - "delete": { - "summary": "Delete a product", - "operationId": "deleteProduct", - "security": [ - { - "bearerAuth": [] - } - ], - "parameters": [ - { - "name": "product_id", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "description": "The product ID of the product to delete" - }, - { - "name": "all_versions", - "in": "query", - "required": false, - "schema": { - "type": "boolean" - }, - "description": "Delete all versions of the product. By default only the latest version is deleted." - } - ], - "x-code-samples": [ - { - "lang": "typescript", - "label": "Delete latest version", - "source": "// Delete latest version\nawait autumn.products.delete(productId);" - }, - { - "lang": "typescript", - "label": "Delete all versions", - "source": "// Delete all versions\nawait autumn.products.delete(productId, { all_versions: true });" - } - ], - "responses": { - "200": { - "description": "Product deleted successfully", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "success": { - "type": "boolean" - } - } - } - } - } - }, - "400": { - "description": "Product cannot be deleted because it has been attached to customers" - }, - "404": { - "description": "Product not found" - } - } - } - }, - "/referrals/code": { - "post": { - "summary": "Get a referral code", - "operationId": "getReferralCode", - "security": [ - { - "bearerAuth": [] - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetReferralCodeRequest" - } - } - } - }, - "responses": { - "200": { - "description": "Referral code generated successfully", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReferralCode" - } - } - } - } - } - } - }, - "/referrals/redeem": { - "post": { - "summary": "Redeem a referral code", - "operationId": "redeemReferralCode", - "security": [ - { - "bearerAuth": [] - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RedeemReferralRequest" - } - } - } - }, - "responses": { - "200": { - "description": "Referral code redeemed successfully", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RedemptionResponse" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "PriceTier": { - "type": "object", - "required": ["to", "amount"], - "properties": { - "to": { - "oneOf": [{ "type": "number" }, { "type": "string" }], - "description": "The maximum amount of usage for this tier." - }, - "amount": { - "type": "number", - "description": "The price of the product item for this tier." - } - } - }, - "ProductItem": { - "type": "object", - "properties": { - "feature_id": { - "type": "string", - "nullable": true, - "description": "The feature ID of the product item. Should be `null` for prices." - }, - "feature_type": { - "type": "string", - "enum": ["single_use", "continuous_use"], - "description": "Single use features are used once and then depleted, like API calls or credits. Continuous use features are those being used on an ongoing-basis, like storage or seats." - }, - "included_usage": { - "oneOf": [ - { "type": "number" }, - { "type": "string", "enum": ["Infinity"] } - ], - "nullable": true, - "description": "The amount of usage included for this feature." - }, - "interval": { - "type": "string", - "nullable": true, - "description": "The reset or billing interval of the product item. If null, feature will have no reset date, and if there's a price, it will be billed one-off." - }, - "usage_model": { - "type": "string", - "enum": ["prepaid", "pay_per_use"], - "description": "Whether the feature should be prepaid upfront or billed for how much they use end of billing period. " - }, - "price": { - "type": "number", - "nullable": true, - "description": "The price of the product item. Should be `null` if tiered pricing is set." - }, - "billing_units": { - "type": "number", - "nullable": true, - "description": "The billing units of the product item (eg $1 for 30 credits). Should be `null` if the feature is prepaid." - }, - "entity_feature_id": { - "type": "string", - "nullable": true, - "description": "The feature ID of the entity (like seats) to track sub-balances for." - }, - "reset_usage_when_enabled": { - "type": "boolean", - "nullable": true, - "description": "Whether the usage should be reset when the product is enabled." - }, - "tiers": { - "type": "array", - "nullable": true, - "items": { - "$ref": "#/components/schemas/PriceTier" - } - } - } - }, - "FreeTrial": { - "type": "object", - "required": ["duration", "length", "unique_fingerprint"], - "properties": { - "duration": { - "type": "string" - }, - "length": { - "type": "number" - }, - "unique_fingerprint": { - "type": "boolean" - } - } - }, - "CreateProductRequest": { - "type": "object", - "required": ["id"], - "properties": { - "id": { - "type": "string", - "description": "The product ID of the product to create, used to identify the product in the API" - }, - "name": { - "type": "string", - "description": "The name of the product" - }, - "is_add_on": { - "type": "boolean", - "default": false, - "description": "Whether the product is an add-on and can be purchased alongside other products" - }, - "is_default": { - "type": "boolean", - "default": false, - "description": "Whether the product should be attached by default to new customers" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ProductItem" - } - }, - "free_trial": { - "$ref": "#/components/schemas/FreeTrial" - } - } - }, - "Product": { - "type": "object", - "properties": { - "created_at": { - "type": "integer", - "description": "The timestamp of when the product was created" - }, - "id": { - "type": "string", - "description": "The ID of the product you set when creating the product" - }, - "name": { - "type": "string", - "description": "The name of the product" - }, - "env": { - "type": "string", - "enum": ["production", "sandbox"], - "description": "The environment of the product" - }, - "is_add_on": { - "type": "boolean", - "description": "Whether the product is an add-on and can be purchased alongside other products" - }, - "is_default": { - "type": "boolean", - "description": "Whether the product is the default product" - }, - "group": { - "type": "string", - "description": "The group of the product" - }, - "version": { - "type": "integer", - "description": "The version of the product" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ProductItem" - } - }, - "free_trial": { - "nullable": true, - "$ref": "#/components/schemas/FreeTrial" - } - } - }, - "GetReferralCodeRequest": { - "type": "object", - "required": ["customer_id", "program_id"], - "properties": { - "customer_id": { - "type": "string", - "description": "The unique identifier of the customer" - }, - "program_id": { - "type": "string", - "description": "ID of your referral program" - } - } - }, - "ReferralCode": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "The referral code that can be shared with customers" - }, - "customer_id": { - "type": "string", - "description": "Your unique identifier for the customer" - }, - "created_at": { - "type": "integer", - "description": "The timestamp of when the referral code was created" - } - } - }, - "RedeemReferralRequest": { - "type": "object", - "required": ["code", "customer_id"], - "properties": { - "code": { - "type": "string", - "description": "The referral code to redeem" - }, - "customer_id": { - "type": "string", - "description": "The unique identifier of the customer redeeming the code" - } - } - }, - "RedemptionResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of the redemption event" - }, - "customer_id": { - "type": "string", - "description": "Your unique identifier for the customer" - }, - "reward_id": { - "type": "string", - "description": "The ID of the reward that will be granted" - } - } - } - }, - "securitySchemes": { - "bearerAuth": { - "type": "http", - "scheme": "bearer" - } - } - } -} diff --git a/apps/docs/mintlify/api/openapi.yml b/apps/docs/mintlify/api/openapi.yml index b8f406fb7..b446d5857 100644 --- a/apps/docs/mintlify/api/openapi.yml +++ b/apps/docs/mintlify/api/openapi.yml @@ -486,28 +486,40 @@ components: properties: id: type: string + description: Unique identifier for the plan. name: type: string + description: Display name of the plan. description: anyOf: - type: string - type: "null" + description: Optional description of the plan. group: anyOf: - type: string - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. version: type: number + description: Version number of the plan. Incremented when plan configuration + changes. add_on: type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. auto_enable: type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. price: anyOf: - type: object properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -516,21 +528,28 @@ components: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. display: type: object properties: primary_text: type: string + description: Main display text (e.g. '$10' or '100 messages'). secondary_text: type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). required: - primary_text + description: Display text for showing this price in pricing pages. required: - amount - interval - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. items: type: array items: @@ -538,6 +557,7 @@ components: properties: feature_id: type: string + description: The ID of the feature this item configures. feature: type: object properties: @@ -598,10 +618,14 @@ components: required: - id - type + description: The full feature object if expanded. included: type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. unlimited: type: boolean + description: Whether the customer has unlimited access to this feature. reset: anyOf: - type: object @@ -617,17 +641,26 @@ components: - quarter - semi_annual - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, usage resets to 0 + and included units are restored. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage persists across + billing cycles. price: anyOf: - type: object properties: amount: type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. tiers: type: array items: @@ -642,6 +675,9 @@ components: required: - to - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or 'amount' is + required. interval: enum: - one_off @@ -650,33 +686,50 @@ components: - quarter - semi_annual - year + description: Billing interval for this price. For consumable features, should + match reset.interval. interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed (e.g. + billing_units=100 means 101 usage rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after included usage." max_purchase: anyOf: - type: number - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, customer can use up + to 400 total before usage is capped. Null for no + limit. required: - interval - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. display: type: object properties: primary_text: type: string + description: Main display text (e.g. '$10' or '100 messages'). secondary_text: type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). required: - primary_text + description: Display text for showing this item in pricing pages. rollover: type: object properties: @@ -684,83 +737,67 @@ components: anyOf: - type: number - type: "null" + description: Maximum rollover units. Null for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - max - expiry_duration_type - proration: - type: object - properties: - on_increase: - enum: - - bill_immediately - - prorate_immediately - - prorate_next_cycle - - bill_next_cycle - on_decrease: - enum: - - prorate - - prorate_immediately - - prorate_next_cycle - - none - - no_prorations + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. required: - feature_id - included - unlimited - reset - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a feature. free_trial: type: object properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year + description: Unit of time for the trial duration ('day', 'month', 'year'). card_required: type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. required: - duration_length - duration_type - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. created_at: type: number + description: Unix timestamp (ms) when the plan was created. env: enum: - sandbox - live + description: Environment this plan belongs to ('sandbox' or 'live'). archived: type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. base_variant_id: anyOf: - type: string - type: "null" - customer_eligibility: - type: object - properties: - trial_available: - type: boolean - scenario: - enum: - - scheduled - - active - - new - - renew - - upgrade - - downgrade - - cancel - - expired - - past_due - required: - - scenario + description: If this is a variant, the ID of the base plan it was created from. required: - id - name @@ -1546,7 +1583,9 @@ paths: autumn = Autumn(secret_key="am_sk_test...") - res = autumn.customers.list(request={}) + res = autumn.customers.list( + request={}, + ) /v1/customers.update: post: operationId: updateCustomer @@ -1936,10 +1975,1184 @@ paths: customer_id="cus_123", delete_in_stripe=False, ) + /v1/plans.create: + post: + operationId: createPlan + summary: Create a plan + description: >- + Creates a new plan with optional base price and feature configurations. + + + Use this to programmatically create pricing plans. See [How plans + work](/documentation/pricing/plans) for concepts. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: The ID of the plan to create. + group: + type: string + default: "" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + name: + type: string + minLength: 1 + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + default: null + description: Optional description of the plan. + add_on: + type: boolean + default: false + description: If true, this plan can be attached alongside other plans. + Otherwise, attaching replaces existing plans in the same + group. + auto_enable: + type: boolean + default: false + description: If true, plan is automatically attached when a customer is created. + Use for free tiers. + price: + type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + required: + - amount + - interval + description: Base recurring price for the plan. Omit for free or usage-only + plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature to configure. + included: + type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. + unlimited: + type: boolean + description: If true, customer has unlimited access to this feature. + reset: + type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. + price: + type: object + properties: + amount: + type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval. For consumable features, should match + reset.interval. + interval_count: + type: number + default: 1 + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." + max_purchase: + type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. + required: + - interval + - billing_method + description: Pricing for usage beyond included units. Omit for free features. + proration: + type: object + properties: + on_increase: + enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. + on_decrease: + enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + description: Credit behavior when quantity decreases mid-cycle. + required: + - on_increase + - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. + rollover: + type: object + properties: + max: + type: number + description: Max rollover units. Omit for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. + required: + - feature_id + description: Feature configurations for this plan. Each item defines included + units, pricing, and reset behavior. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + default: month + description: Unit of time for the trial ('day', 'month', 'year'). + card_required: + type: boolean + default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. + required: + - duration_length + description: Free trial configuration. Customers can try this plan before being + charged. + required: + - plan_id + - name + title: CreatePlanParams + examples: + - &a8 + plan_id: free_plan + name: Free + auto_enable: true + items: + - feature_id: messages + included: 100 + reset: + interval: month + - plan_id: pro_plan + name: Pro Plan + price: + amount: 10 + interval: month + items: + - feature_id: messages + included: 1000 + reset: + interval: month + price: + amount: 0.01 + interval: month + billing_units: 1 + billing_method: usage_based + - plan_id: team_plan + name: Team Plan + price: + amount: 49 + interval: month + items: + - feature_id: seats + included: 5 + price: + amount: 10 + interval: month + billing_units: 1 + billing_method: prepaid + example: *a8 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration + changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, usage + resets to 0 and included units are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage + persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or + 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should + match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed (e.g. + billing_units=100 means 101 usage rounds to + 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after + included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, customer + can use up to 400 total before usage is + capped. Null for no limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that + can be attached to customers. + examples: + - &a9 + id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + example: *a9 + x-speakeasy-name-override: create + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.plans.create({ + planId: "free_plan", + name: "Free", + autoEnable: true, + items: [ + { + featureId: "messages", + included: 100, + reset: { + interval: "month", + }, + }, + ], + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.plans.create( + plan_id="free_plan", + name="Free", + group="", + add_on=False, + auto_enable=True, + items=[ + { + "feature_id": "messages", + "included": 100, + "reset": { + "interval": "month", + }, + }, + ], + ) + /v1/plans.get: + post: + operationId: getPlan + summary: Get a plan + description: >- + Retrieves a single plan by its ID. + + + Use this to fetch the full configuration of a specific plan, including + its features and pricing. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + description: The ID of the plan to retrieve. + version: + type: number + description: The version of the plan to get. Defaults to the latest version. + required: + - plan_id + title: GetPlanParams + examples: + - &a10 + plan_id: pro_plan + - plan_id: pro_plan + version: 2 + example: *a10 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration + changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, usage + resets to 0 and included units are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage + persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or + 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should + match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed (e.g. + billing_units=100 means 101 usage rounds to + 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after + included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, customer + can use up to 400 total before usage is + capped. Null for no limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that + can be attached to customers. + examples: + - &a11 + id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + example: *a11 + x-speakeasy-name-override: get + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.plans.get({ + planId: "pro_plan", + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.plans.get(plan_id="pro_plan") /v1/plans.list: post: operationId: listPlans summary: List all plans + description: >- + Lists all plans in the current environment. + + + Use this to retrieve all plans for displaying pricing pages or managing + plan configurations. tags: - plans requestBody: @@ -1951,10 +3164,20 @@ paths: properties: customer_id: type: string + description: Customer ID to include eligibility info (trial availability, attach + scenario). entity_id: type: string + description: Entity ID for entity-scoped plans. include_archived: type: boolean + description: If true, includes archived plans in the response. + title: ListPlansParams + examples: + - &a12 {} + - customer_id: cus_123 + - include_archived: true + example: *a12 responses: "200": description: OK @@ -1966,9 +3189,393 @@ paths: list: type: array items: - $ref: "#/components/schemas/Plan" + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration + changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, + usage resets to 0 and included units + are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage + persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or + 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should + match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed + (e.g. billing_units=100 means 101 + usage rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after + included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, + customer can use up to 400 total + before usage is capped. Null for no + limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a + feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that + can be attached to customers. required: - list + examples: + - &a13 + list: + - id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + example: *a13 x-speakeasy-name-override: list parameters: - name: x-api-version @@ -1986,7 +3593,7 @@ paths: const autumn = new Autumn() - const result = await autumn.plans.list(); + const result = await autumn.plans.list({}); - lang: python label: Python (SDK) source: |- @@ -1994,7 +3601,773 @@ paths: autumn = Autumn(secret_key="am_sk_test...") - res = autumn.plans.list() + res = autumn.plans.list( + request={}, + ) + /v1/plans.update: + post: + operationId: updatePlan + summary: Update a plan + description: >- + Updates an existing plan. Creates a new version unless `disableVersion` + is set. + + + Use this to modify plan properties, pricing, or feature configurations. + See [Adding features to plans](/documentation/pricing/plan-features) for + item configuration. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: The ID of the plan to update. + group: + type: string + default: "" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + name: + type: string + minLength: 1 + description: Display name of the plan. + description: + type: string + add_on: + type: boolean + description: Whether the plan is an add-on. + auto_enable: + type: boolean + description: Whether the plan is automatically enabled. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + required: + - amount + - interval + - type: "null" + description: The price of the plan. Set to null to remove the base price. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature to configure. + included: + type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. + unlimited: + type: boolean + description: If true, customer has unlimited access to this feature. + reset: + type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. + price: + type: object + properties: + amount: + type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval. For consumable features, should match + reset.interval. + interval_count: + type: number + default: 1 + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." + max_purchase: + type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. + required: + - interval + - billing_method + description: Pricing for usage beyond included units. Omit for free features. + proration: + type: object + properties: + on_increase: + enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. + on_decrease: + enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + description: Credit behavior when quantity decreases mid-cycle. + required: + - on_increase + - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. + rollover: + type: object + properties: + max: + type: number + description: Max rollover units. Omit for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. + required: + - feature_id + description: Feature configurations for this plan. Each item defines included + units, pricing, and reset behavior. + free_trial: + anyOf: + - type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + default: month + description: Unit of time for the trial ('day', 'month', 'year'). + card_required: + type: boolean + default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. + required: + - duration_length + - type: "null" + description: The free trial of the plan. Set to null to remove the free trial. + version: + type: number + archived: + type: boolean + default: false + new_plan_id: + type: string + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: The new ID to use for the plan. Can only be updated if the plan has + not been used by any customers. + required: + - plan_id + title: UpdatePlanParams + examples: + - &a14 + plan_id: pro_plan + name: Pro Plan (Updated) + price: + amount: 15 + interval: month + - plan_id: pro_plan + price: null + - plan_id: old_plan + archived: true + example: *a14 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration + changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, usage + resets to 0 and included units are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage + persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or + 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should + match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed (e.g. + billing_units=100 means 101 usage rounds to + 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after + included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, customer + can use up to 400 total before usage is + capped. Null for no limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that + can be attached to customers. + examples: + - &a15 + id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + example: *a15 + x-speakeasy-name-override: update + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.plans.update({ + planId: "pro_plan", + name: "Pro Plan (Updated)", + price: { + amount: 15, + interval: "month", + }, + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.plans.update( + plan_id="pro_plan", + group="", + name="Pro Plan (Updated)", + price={ + "amount": 15, + "interval": "month", + }, + archived=False, + ) + /v1/plans.delete: + post: + operationId: deletePlan + summary: Delete a plan + description: >- + Deletes a plan by its ID. + + + Use this to permanently remove a plan. Plans with active customers + cannot be deleted - archive them instead. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + description: The ID of the plan to delete. + all_versions: + type: boolean + default: false + description: If true, deletes all versions of the plan. Otherwise, only deletes + the latest version. + required: + - plan_id + title: DeletePlanParams + examples: + - &a16 + plan_id: unused_plan + - plan_id: legacy_plan + all_versions: true + example: *a16 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + required: + - success + x-speakeasy-name-override: delete + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.plans.delete({ + planId: "unused_plan", + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.plans.delete( + plan_id="unused_plan", + all_versions=False, + ) /v1/features.create: post: operationId: createFeature @@ -2071,7 +4444,7 @@ paths: - feature_id title: CreateFeatureParams examples: - - &a8 + - &a17 feature_id: api-calls name: API Calls type: metered @@ -2085,7 +4458,7 @@ paths: credit_cost: 1 - metered_feature_id: image-generations credit_cost: 10 - example: *a8 + example: *a17 responses: "200": description: OK @@ -2161,7 +4534,7 @@ paths: - consumable - archived examples: - - &a9 + - &a18 id: api-calls name: API Calls type: metered @@ -2170,7 +4543,7 @@ paths: display: singular: API call plural: API calls - example: *a9 + example: *a18 x-speakeasy-name-override: create parameters: - name: x-api-version @@ -2230,9 +4603,9 @@ paths: - feature_id title: GetFeatureParams examples: - - &a10 + - &a19 feature_id: api-calls - example: *a10 + example: *a19 responses: "200": description: OK @@ -2308,7 +4681,7 @@ paths: - consumable - archived examples: - - &a11 + - &a20 id: api-calls name: API Calls type: metered @@ -2317,7 +4690,7 @@ paths: display: singular: API call plural: API calls - example: *a11 + example: *a20 x-speakeasy-name-override: get parameters: - name: x-api-version @@ -2439,7 +4812,7 @@ paths: required: - list examples: - - &a12 + - &a21 list: - id: api-calls name: API Calls @@ -2462,7 +4835,7 @@ paths: display: singular: credit plural: credits - example: *a12 + example: *a21 x-speakeasy-name-override: list parameters: - name: x-api-version @@ -2572,7 +4945,7 @@ paths: - feature_id title: UpdateFeatureParams examples: - - &a13 + - &a22 feature_id: api-calls name: API Requests display: @@ -2580,7 +4953,7 @@ paths: plural: API requests - feature_id: old-feature archived: true - example: *a13 + example: *a22 responses: "200": description: OK @@ -2656,7 +5029,7 @@ paths: - consumable - archived examples: - - &a14 + - &a23 id: api-calls name: API Calls type: metered @@ -2665,7 +5038,7 @@ paths: display: singular: API call plural: API calls - example: *a14 + example: *a23 x-speakeasy-name-override: update parameters: - name: x-api-version @@ -2702,8 +5075,8 @@ paths: feature_id="api-calls", name="API Requests", display={ - "singular": "API request", - "plural": "API requests", + "singular": "API request", + "plural": "API requests", }, ) /v1/features.delete: @@ -2731,9 +5104,9 @@ paths: - feature_id title: DeleteFeatureParams examples: - - &a15 + - &a24 feature_id: old-feature - example: *a15 + example: *a24 responses: "200": description: OK @@ -2747,9 +5120,9 @@ paths: required: - success examples: - - &a16 + - &a25 success: true - example: *a16 + example: *a25 x-speakeasy-name-override: delete parameters: - name: x-api-version @@ -2833,15 +5206,19 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. required: - duration_length - type: "null" @@ -2856,6 +5233,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -2864,8 +5242,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -2877,10 +5257,14 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -2895,15 +5279,22 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. tiers: type: array items: @@ -2918,6 +5309,8 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -2926,21 +5319,31 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match + reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -2950,6 +5353,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -2957,22 +5361,30 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the @@ -3050,10 +5462,10 @@ paths: - plan_id title: AttachParams examples: - - &a17 + - &a26 customer_id: cus_123 plan_id: pro_plan - example: *a17 + example: *a26 responses: "200": description: OK @@ -3126,10 +5538,10 @@ paths: - customer_id - payment_url examples: - - &a18 + - &a27 customer_id: cus_123 payment_url: https://checkout.stripe.com/... - example: *a18 + example: *a27 x-speakeasy-name-override: attach parameters: - name: x-api-version @@ -3217,15 +5629,19 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. required: - duration_length - type: "null" @@ -3240,6 +5656,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -3248,8 +5665,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -3261,10 +5680,14 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -3279,15 +5702,22 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. tiers: type: array items: @@ -3302,6 +5732,8 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -3310,21 +5742,31 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match + reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -3334,6 +5776,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -3341,22 +5784,30 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the @@ -3434,10 +5885,10 @@ paths: - plan_id title: PreviewAttachParams examples: - - &a19 + - &a28 customer_id: cus_123 plan_id: pro_plan - example: *a19 + example: *a28 responses: "200": description: OK @@ -3511,7 +5962,7 @@ paths: - total - currency examples: - - &a20 + - &a29 customerId: charles lineItems: - title: Pro seed @@ -3520,7 +5971,7 @@ paths: discounts: [] total: 20 currency: usd - example: *a20 + example: *a29 x-speakeasy-name-override: previewAttach parameters: - name: x-api-version @@ -3608,15 +6059,19 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. required: - duration_length - type: "null" @@ -3631,6 +6086,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -3639,8 +6095,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -3652,10 +6110,14 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -3670,15 +6132,22 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. tiers: type: array items: @@ -3693,6 +6162,8 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -3701,21 +6172,31 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match + reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -3725,6 +6206,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -3732,22 +6214,30 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the @@ -3796,13 +6286,13 @@ paths: - plan_id title: UpdateSubscriptionParams examples: - - &a21 + - &a30 customer_id: cus_123 plan_id: pro_plan feature_quantities: - feature_id: seats quantity: 10 - example: *a21 + example: *a30 responses: "200": description: OK @@ -3875,7 +6365,7 @@ paths: - customer_id - payment_url examples: - - &a22 + - &a31 customer_id: cus_123 invoice: status: paid @@ -3884,7 +6374,7 @@ paths: currency: usd hosted_invoice_url: https://invoice.stripe.com/... payment_url: null - example: *a22 + example: *a31 x-speakeasy-name-override: update parameters: - name: x-api-version @@ -3923,10 +6413,10 @@ paths: customer_id="cus_123", plan_id="pro_plan", feature_quantities=[ - { - "feature_id": "seats", - "quantity": 10, - }, + { + "feature_id": "seats", + "quantity": 10, + }, ], ) /v1/billing.preview_update: @@ -3984,15 +6474,19 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. required: - duration_length - type: "null" @@ -4007,6 +6501,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -4015,8 +6510,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -4028,10 +6525,14 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -4046,15 +6547,22 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. tiers: type: array items: @@ -4069,6 +6577,8 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -4077,21 +6587,31 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match + reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -4101,6 +6621,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -4108,22 +6629,30 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the @@ -4172,13 +6701,13 @@ paths: - plan_id title: PreviewUpdateParams examples: - - &a23 + - &a32 customer_id: cus_123 plan_id: pro_plan feature_quantities: - feature_id: seats quantity: 15 - example: *a23 + example: *a32 responses: "200": description: OK @@ -4252,7 +6781,7 @@ paths: - total - currency examples: - - &a24 + - &a33 customerId: charles lineItems: - title: Pro seed @@ -4261,7 +6790,7 @@ paths: discounts: [] total: 20 currency: usd - example: *a24 + example: *a33 x-speakeasy-name-override: previewUpdate parameters: - name: x-api-version @@ -4300,10 +6829,10 @@ paths: customer_id="cus_123", plan_id="pro_plan", feature_quantities=[ - { - "feature_id": "seats", - "quantity": 15, - }, + { + "feature_id": "seats", + "quantity": 15, + }, ], ) /v1/billing.open_customer_portal: @@ -4335,10 +6864,10 @@ paths: - customer_id title: OpenCustomerPortalParams examples: - - &a25 + - &a34 customer_id: cus_123 return_url: https://useautumn.com - example: *a25 + example: *a34 responses: "200": description: OK @@ -4357,10 +6886,10 @@ paths: - customer_id - url examples: - - &a26 + - &a35 customer_id: cus_123 url: https://billing.stripe.com/session/... - example: *a26 + example: *a35 x-speakeasy-name-override: openCustomerPortal parameters: - name: x-api-version @@ -4393,6 +6922,97 @@ paths: customer_id="cus_123", return_url="https://useautumn.com", ) + /v1/billing.setup_payment: + post: + operationId: setupPayment + description: Create a payment setup session for a customer to add or update + their payment method. + tags: + - billing + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer + success_url: + type: string + description: URL to redirect to after successful payment setup. Must start with + either http:// or https:// + customer_data: + $ref: "#/components/schemas/CustomerData" + checkout_session_params: + type: object + propertyNames: + type: string + additionalProperties: {} + description: Additional parameters for the checkout session + required: + - customer_id + title: SetupPaymentParams + examples: + - &a36 + customer_id: cus_123 + success_url: https://example.com/account/billing + example: *a36 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer + url: + type: string + description: URL to the payment setup page + required: + - customer_id + - url + examples: + - &a37 + customer_id: cus_123 + payment_url: https://checkout.stripe.com/... + example: *a37 + x-speakeasy-name-override: setupPayment + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.billing.setupPayment({ + customerId: "cus_123", + successUrl: "https://example.com/account/billing", + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.billing.setup_payment( + customer_id="cus_123", + success_url="https://example.com/account/billing", + ) /v1/balances.create: post: operationId: createBalance @@ -4458,13 +7078,13 @@ paths: - feature_id title: CreateBalanceParams examples: - - &a27 + - &a38 customer_id: cus_123 feature_id: api_calls included: 1000 reset: interval: month - example: *a27 + example: *a38 responses: "200": description: OK @@ -4514,7 +7134,7 @@ paths: feature_id="api_calls", included=1000, reset={ - "interval": "month", + "interval": "month", }, ) /v1/balances.update: @@ -4567,11 +7187,11 @@ paths: - feature_id title: UpdateBalanceParams examples: - - &a28 + - &a39 customer_id: cus_123 feature_id: api_calls remaining: 5 - example: *a28 + example: *a39 responses: "200": description: OK @@ -4669,14 +7289,14 @@ paths: - feature_id title: CheckParams examples: - - &a29 + - &a40 customer_id: cus_123 feature_id: messages - customer_id: cus_123 feature_id: messages required_balance: 3 send_event: true - example: *a29 + example: *a40 responses: "200": description: OK @@ -5057,7 +7677,7 @@ paths: - customer_id - balance examples: - - &a30 + - &a41 allowed: true customer_id: cus_123 entity_id: null @@ -5084,7 +7704,7 @@ paths: resets_at: 1773851121437 price: null expires_at: null - example: *a30 + example: *a41 x-speakeasy-name-override: check parameters: - name: x-api-version @@ -5163,11 +7783,11 @@ paths: - customer_id title: TrackParams examples: - - &a31 + - &a42 customer_id: cus_123 feature_id: messages value: 1 - example: *a31 + example: *a42 responses: "200": description: OK @@ -5208,7 +7828,7 @@ paths: - value - balance examples: - - &a32 + - &a43 customer_id: cus_123 value: 1 balance: @@ -5233,7 +7853,7 @@ paths: resets_at: 1773851121437 price: null expires_at: null - example: *a32 + example: *a43 x-speakeasy-name-override: track parameters: - name: x-api-version @@ -5318,14 +7938,14 @@ paths: description: Filter events by time range title: EventsListParams examples: - - &a33 + - &a44 customer_id: cus_123 limit: 50 - feature_id: api_calls custom_range: start: 1704067200000 end: 1706745600000 - example: *a33 + example: *a44 responses: "200": description: OK @@ -5384,7 +8004,7 @@ paths: - limit - total examples: - - &a34 + - &a45 list: - id: evt_36xpk2TmuQX5zVPPQ8tCtnR5Weg timestamp: 1765958215459 @@ -5402,7 +8022,7 @@ paths: has_more: false offset: 0 limit: 100 - example: *a34 + example: *a45 x-speakeasy-name-override: list parameters: - name: x-api-version @@ -5504,7 +8124,7 @@ paths: - feature_id title: EventsAggregateParams examples: - - &a35 + - &a46 customer_id: cus_123 feature_id: api_calls range: 30d @@ -5515,7 +8135,7 @@ paths: - messages range: 7d group_by: properties.model - example: *a35 + example: *a46 responses: "200": description: OK @@ -5577,7 +8197,7 @@ paths: - list - total examples: - - &a36 + - &a47 list: - period: 1762905600000 values: @@ -5624,7 +8244,7 @@ paths: sessions: count: 2 sum: 15 - example: *a36 + example: *a47 x-speakeasy-name-override: aggregate parameters: - name: x-api-version @@ -5703,12 +8323,12 @@ paths: - entity_id title: CreateEntityParams examples: - - &a37 + - &a48 customer_id: cus_123 entity_id: seat_42 feature_id: seats name: Seat 42 - example: *a37 + example: *a48 responses: "200": description: OK @@ -5898,7 +8518,7 @@ paths: - purchases - balances examples: - - &a38 + - &a49 id: seat_42 name: Seat 42 customer_id: cus_123 @@ -5943,7 +8563,7 @@ paths: price: null expires_at: null invoices: [] - example: *a38 + example: *a49 x-speakeasy-name-override: create parameters: - name: x-api-version @@ -6008,11 +8628,11 @@ paths: - entity_id title: GetEntityParams examples: - - &a39 + - &a50 entity_id: seat_42 - customer_id: cus_123 entity_id: seat_42 - example: *a39 + example: *a50 responses: "200": description: OK @@ -6202,7 +8822,7 @@ paths: - purchases - balances examples: - - &a40 + - &a51 id: seat_42 name: Seat 42 customer_id: cus_123 @@ -6247,7 +8867,7 @@ paths: price: null expires_at: null invoices: [] - example: *a40 + example: *a51 x-speakeasy-name-override: get parameters: - name: x-api-version @@ -6304,10 +8924,10 @@ paths: - entity_id title: DeleteEntityParams examples: - - &a41 + - &a52 customer_id: cus_123 entity_id: seat_42 - example: *a41 + example: *a52 responses: "200": description: OK @@ -6321,9 +8941,9 @@ paths: required: - success examples: - - &a42 + - &a53 success: true - example: *a42 + example: *a53 x-speakeasy-name-override: delete parameters: - name: x-api-version @@ -6380,10 +9000,10 @@ paths: - program_id title: CreateReferralCodeParams examples: - - &a43 + - &a54 customer_id: cus_123 program_id: prog_123 - example: *a43 + example: *a54 responses: "200": description: OK @@ -6406,11 +9026,11 @@ paths: - customer_id - created_at examples: - - &a44 + - &a55 code: customer_id: created_at: 123 - example: *a44 + example: *a55 x-speakeasy-name-override: createCode parameters: - name: x-api-version @@ -6467,10 +9087,10 @@ paths: - customer_id title: RedeemReferralCodeParams examples: - - &a45 + - &a56 code: REF123 customer_id: cus_456 - example: *a45 + example: *a56 responses: "200": description: OK @@ -6493,11 +9113,11 @@ paths: - customer_id - reward_id examples: - - &a46 + - &a57 id: customer_id: reward_id: - example: *a46 + example: *a57 x-speakeasy-name-override: redeemCode parameters: - name: x-api-version diff --git a/apps/docs/mintlify/docs.json b/apps/docs/mintlify/docs.json index 9d567a67b..297a5ac0f 100644 --- a/apps/docs/mintlify/docs.json +++ b/apps/docs/mintlify/docs.json @@ -137,7 +137,8 @@ "api-reference/billing/billingUpdate", "api-reference/billing/previewAttach", "api-reference/billing/previewUpdate", - "api-reference/billing/openCustomerPortal" + "api-reference/billing/openCustomerPortal", + "api-reference/billing/setupPayment" ] }, { @@ -173,6 +174,16 @@ "api-reference/entities/deleteEntity" ] }, + { + "group": "Plans", + "pages": [ + "api-reference/plans/getPlan", + "api-reference/plans/listPlans", + "api-reference/plans/createPlan", + "api-reference/plans/updatePlan", + "api-reference/plans/deletePlan" + ] + }, { "group": "Features", "pages": [ @@ -183,6 +194,7 @@ "api-reference/features/deleteFeature" ] }, + { "group": "Referrals", "pages": [ @@ -194,18 +206,6 @@ "group": "TODO", "pages": ["api-reference/billing/setupPayment"] }, - - { - "group": "Products", - "pages": [ - "api-reference/products/get-product", - "api-reference/products/list-products", - "api-reference/products/create-product", - "api-reference/products/update-product", - "api-reference/products/delete-product" - ] - }, - { "group": "Platform (Beta)", "pages": [ diff --git a/apps/sdk-test/sdk.ts b/apps/sdk-test/sdk.ts index 31b29c2ce..71ccde2ae 100644 --- a/apps/sdk-test/sdk.ts +++ b/apps/sdk-test/sdk.ts @@ -1,17 +1,37 @@ -import { join } from "node:path"; -import { config as dotenvConfig } from "dotenv"; - -dotenvConfig({ path: join(__dirname, ".env") }); - import { Autumn } from "autumn-js"; const autumn = new Autumn({ secretKey: process.env.AUTUMN_SECRET_KEY, }); -const res = await autumn.features.update({ - featureId: "messages", - name: "Messages", +const res = await autumn.plans.create({ + planId: "pro_plan", + name: "Pro Plan", + price: { + amount: 10, + interval: "month", + }, + items: [ + { + featureId: "messages", + included: 100, + + price: { + amount: 0.5, + interval: "month", + billingUnits: 100, + billingMethod: "usage_based", + }, + }, + { + featureId: "users", + price: { + interval: "month", + amount: 10, + billingMethod: "prepaid", + }, + }, + ], }); console.log(JSON.stringify(res, null, 2)); diff --git a/bun.lock b/bun.lock index c801efa57..e120136df 100644 --- a/bun.lock +++ b/bun.lock @@ -168,7 +168,7 @@ }, "packages/sdk": { "name": "@useautumn/sdk", - "version": "0.10.8", + "version": "0.10.15", "dependencies": { "zod": "^3.25.65 || ^4.0.0", }, diff --git a/others/python-sdk/.speakeasy/code-samples.overlay.yaml b/others/python-sdk/.speakeasy/code-samples.overlay.yaml index 7d75fc8d3..ed4ff7f11 100644 --- a/others/python-sdk/.speakeasy/code-samples.overlay.yaml +++ b/others/python-sdk/.speakeasy/code-samples.overlay.yaml @@ -152,6 +152,24 @@ actions: }, ]) + # Handle response + print(res) + - target: $["paths"]["/v1/billing.setup_payment"]["post"] + update: + x-codeSamples: + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + + with Autumn( + x_api_version="2.1", + secret_key="", + ) as autumn: + + res = autumn.billing.setup_payment(customer_id="cus_123", success_url="https://example.com/account/billing") + # Handle response print(res) - target: $["paths"]["/v1/billing.update"]["post"] @@ -430,6 +448,68 @@ actions: "plural": "API requests", }) + # Handle response + print(res) + - target: $["paths"]["/v1/plans.create"]["post"] + update: + x-codeSamples: + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + + with Autumn( + x_api_version="2.1", + secret_key="", + ) as autumn: + + res = autumn.plans.create(plan_id="free_plan", name="Free", group="", add_on=False, auto_enable=True, items=[ + { + "feature_id": "messages", + "included": 100, + "reset": { + "interval": "month", + }, + }, + ]) + + # Handle response + print(res) + - target: $["paths"]["/v1/plans.delete"]["post"] + update: + x-codeSamples: + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + + with Autumn( + x_api_version="2.1", + secret_key="", + ) as autumn: + + res = autumn.plans.delete(plan_id="unused_plan", all_versions=False) + + # Handle response + print(res) + - target: $["paths"]["/v1/plans.get"]["post"] + update: + x-codeSamples: + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + + with Autumn( + x_api_version="2.1", + secret_key="", + ) as autumn: + + res = autumn.plans.get(plan_id="pro_plan") + # Handle response print(res) - target: $["paths"]["/v1/plans.list"]["post"] @@ -446,7 +526,28 @@ actions: secret_key="", ) as autumn: - res = autumn.plans.list() + res = autumn.plans.list(request={}) + + # Handle response + print(res) + - target: $["paths"]["/v1/plans.update"]["post"] + update: + x-codeSamples: + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + + with Autumn( + x_api_version="2.1", + secret_key="", + ) as autumn: + + res = autumn.plans.update(plan_id="pro_plan", group="", name="Pro Plan (Updated)", price={ + "amount": 15, + "interval": "month", + }, archived=False) # Handle response print(res) diff --git a/others/python-sdk/.speakeasy/gen.lock b/others/python-sdk/.speakeasy/gen.lock index 705ae7a11..5a85a23fd 100644 --- a/others/python-sdk/.speakeasy/gen.lock +++ b/others/python-sdk/.speakeasy/gen.lock @@ -1,16 +1,16 @@ lockVersion: 2.0.0 id: 05940b80-1ef8-40f4-9878-822fb2792070 management: - docChecksum: 29a0fecdd68e0bb1b9d92fceb24902b3 + docChecksum: 83e7719406bc862f49ed389237003f2d docVersion: 2.1.0 speakeasyVersion: 1.719.0 generationVersion: 2.824.1 - releaseVersion: 0.4.8 - configChecksum: 85955af5004eed7986278f5510e11006 + releaseVersion: 0.4.15 + configChecksum: 149bd5a3b8d85cc19ba9f44c89c8199c persistentEdits: - generation_id: ce1f6c07-d888-4e2b-af13-47c7fcd0ea87 - pristine_commit_hash: 35f21341c82b3e297799a685a2481e8664b45a2f - pristine_tree_hash: 03629b2bec2ac5e22c0d3553a5f96b29d82f35dd + generation_id: cd600ce0-3c71-4cd6-acd6-a00b5ff53e58 + pristine_commit_hash: 788671e0c9c187d2659e6e3272dd0540455ec8ac + pristine_tree_hash: f35aa49e205305de977c182f12035559a2cb1419 features: python: additionalDependencies: 1.0.0 @@ -125,8 +125,8 @@ trackedFiles: pristine_git_object: 65926ef8f013057008c30089fbacd1982f32ee7c docs/models/billingattachbillingmethod.md: id: 7ad8ef9b29bf - last_write_checksum: sha1:3383175a4afd03a1224c5fef2f9a3e060a7fb64a - pristine_git_object: 1f193df28aa2b713fdc76464f428e1421bd89446 + last_write_checksum: sha1:241dab01905175215909ddd7458ee6213a286b8e + pristine_git_object: 01d5f7eda7084059d7279155a23110ab35090d51 docs/models/billingattachcode.md: id: f8bd734cbf81 last_write_checksum: sha1:596cc379144fb4058cec3dcfdab10e8f944d873d @@ -149,20 +149,20 @@ trackedFiles: pristine_git_object: 0dd81e2073cd70308bf8763db258d8f9ac49e625 docs/models/billingattachdurationtype.md: id: 423b10a9b2e9 - last_write_checksum: sha1:771062ad742a99a1da9e3fc5faeb859f22c0fb40 - pristine_git_object: fae86af7cd4b848be77282793947233e2a5c2fdd + last_write_checksum: sha1:6ca49c53520db8675991ab49ecded773ed0be217 + pristine_git_object: 41bb3014ba0a189dd669fb4e300c14f56b2ac6d7 docs/models/billingattachexpirydurationtype.md: id: 24dc4cb9d4b8 - last_write_checksum: sha1:8d412d026e4a835022e04b96c7a5a220eb2cc16f - pristine_git_object: 05f095171b7259f3c7e76b5ac44d08171f3f9aef + last_write_checksum: sha1:971cdc5c7434d8582e18987465208094578c12ef + pristine_git_object: 101777f7609e305d3df625923c669c2c96343eaa docs/models/billingattachfeaturequantity.md: id: d90f6bb025f7 last_write_checksum: sha1:a49720e8f06c3716251f3a2a91433c081dd39046 pristine_git_object: 486e96a2cdae09c3370f46f77a94f50c0b3e3053 docs/models/billingattachfreetrial.md: id: 736b3640c65a - last_write_checksum: sha1:ac79c07d3ef237c4694196fa533c568fb97d8222 - pristine_git_object: c3641698ddca5d7672a18bac99afacae862ecc7e + last_write_checksum: sha1:6acd060202d82765a1b34ddc4a608689617cb486 + pristine_git_object: bae7488ab732fd0042e0ccc90ee1c40cccbb5890 docs/models/billingattachglobals.md: id: 8f8ad3068a94 last_write_checksum: sha1:2a5da9e7e6545e7b8dcfbf8ace9559e684a0ab6f @@ -177,60 +177,60 @@ trackedFiles: pristine_git_object: 51e60356861b229b8e6d06b66c83addc54ad8d67 docs/models/billingattachitem.md: id: d843385ee259 - last_write_checksum: sha1:c137dd6c71a0736bfc0f5529a62dc70b0062267d - pristine_git_object: 16049a84ea66716e0e23c91c9b8e598b0d08d7c4 + last_write_checksum: sha1:83e8081bb6676e42d9fed1074c885dfa7b418b7c + pristine_git_object: a1d327d3a8033f86ee8ca53919796edf6f070bfa docs/models/billingattachitemprice.md: id: fddf6886f188 - last_write_checksum: sha1:eb3b135dcbf89be75fbc52bba0967914085a441e - pristine_git_object: 9c1568802f77a489b7b702612d2e8cf657f74199 + last_write_checksum: sha1:865e1fd71e7e4a91479b5d022249898dc6a5182d + pristine_git_object: 25f38face4d0585151303512efea8a4cf3eae0e1 docs/models/billingattachitempriceinterval.md: id: 233d8a371330 - last_write_checksum: sha1:286efb3975b29d93301e9477a9445d95d3c11ae4 - pristine_git_object: d89b9e874cf6a01d6016f40aa698a9a37cdc7ca3 + last_write_checksum: sha1:5be75fb2a88e04d5d4fe9b8665eefb5ac5d5881b + pristine_git_object: 4a2673a0ea3b42d3b982d69ed0ed423ee83992b8 docs/models/billingattachondecrease.md: id: 27ec2494ba22 - last_write_checksum: sha1:4794e6dc841af18ff95f8d91abb0e59131fcc893 - pristine_git_object: 63ed5ada10fa636b3e5cbc41d1c9c49ddc33c866 + last_write_checksum: sha1:29e11073cd4d07e1d11aafacf4c7c7ddfa178e80 + pristine_git_object: 4c0da568f10c897c33fb91d0817aa9b4251c979c docs/models/billingattachonincrease.md: id: c24185dbd0eb - last_write_checksum: sha1:49f938efc927c0d4702b944f829a81eea80b0f43 - pristine_git_object: 388a9c513dd970fdd67bcdf2132b9bf689a05358 + last_write_checksum: sha1:af07f3259f59ec14d71fa18e65aa807f68318244 + pristine_git_object: c62c020f78e93547635c43ac1ba542af04f9a4b0 docs/models/billingattachplanschedule.md: id: e84335661ec5 last_write_checksum: sha1:4ccc9f401c17e931428b8e5bb3584f3b362941cd pristine_git_object: ae7e98ddb1c2f8a108c4443d13eaf208259b2896 docs/models/billingattachprice.md: id: df5b6c3b336d - last_write_checksum: sha1:7f78242b077878f1e086ecefe7d6085efcfee80d - pristine_git_object: cdd55bdfd41e95b1fa6165bb2fb86914648a29ea + last_write_checksum: sha1:c5622093bae4dd820e1862a6ec6ef949a174243a + pristine_git_object: 2a447950de65dbf21a28ffb4245919307cc07f79 docs/models/billingattachpriceinterval.md: id: eaa3d567a6a0 - last_write_checksum: sha1:0242405c2fe49e6221073bf49e8db1541f0ba0b1 - pristine_git_object: 0051c7f5da96beabdbd33f616601d7bd1a26d89d + last_write_checksum: sha1:e69007104b8b17bdd9133bb727201e12188f8a18 + pristine_git_object: a7345fc65589779ec1090bb8cf001a44f403b437 docs/models/billingattachproration.md: id: 645f794f4b6f - last_write_checksum: sha1:ed2188c971ad23f75660d649df8a44c6fb2e3674 - pristine_git_object: 8199d7165a7b38affb8a113a74bb0fba95a06271 + last_write_checksum: sha1:5d7aa6a47970454040a69df33a5ab2f68aa0a14b + pristine_git_object: 9ac101fd7f3fb5f41d2fa213b3710744cdbc5ab1 docs/models/billingattachrequiredaction.md: id: 0f167f88f79b last_write_checksum: sha1:ad9f1196709a837801063b080e51c6f919568126 pristine_git_object: 5f3fb0c03a43b4eabda20825383b07aeee9b0851 docs/models/billingattachreset.md: id: 8954129e8688 - last_write_checksum: sha1:eaee756fd6ff53282c7e36bbd70b8b67e66ac319 - pristine_git_object: 27311c4697dcb6ed5914c0aa983b942140c64cb8 + last_write_checksum: sha1:1e6db81a816adaa19bd8c6e376adb35bc28a98ee + pristine_git_object: d127502e3b02901079c92da7031f3a77afc2cb21 docs/models/billingattachresetinterval.md: id: c1d7423c3b30 - last_write_checksum: sha1:dff4eefe5579a2fd29c7c7d6f528ec4b181805af - pristine_git_object: fd1fcac8c7475335b59c3ee405e4e00ae19313bd + last_write_checksum: sha1:16d8df4eecd657df14c546e2ad0b503e3f2b681d + pristine_git_object: 9591192f62394807d33f79f55249a419a45095f3 docs/models/billingattachresponse.md: id: f869a9b1abfd last_write_checksum: sha1:96dc9581930a325b5d1d9a01be7bf3f5e183a6d0 pristine_git_object: 476b0cefe7948a33d7f761c8606162fd49901646 docs/models/billingattachrollover.md: id: dc8d51bff90f - last_write_checksum: sha1:a8dd1548dad25df79a116e30ee5f5ea617ddbc4f - pristine_git_object: 0311da1a2bd84efa7e9d6a24cf9165dc1eeb2ef6 + last_write_checksum: sha1:3cead3b3d2adafd217830980cd62481c518b51c2 + pristine_git_object: 5eb116656b3d57ed4d1f27e879262ef51a0d093d docs/models/billingattachtier.md: id: e5fbb17d1129 last_write_checksum: sha1:8d331efeb9148debb1061d3a03b9899c21123b06 @@ -245,8 +245,8 @@ trackedFiles: pristine_git_object: 6299d3db69544f12ee49122ebf8fd2b908ec03be docs/models/billingupdatebillingmethod.md: id: 12159f4a0d20 - last_write_checksum: sha1:815c9662774de00037334f98fbd5b97c6597b175 - pristine_git_object: e29001f5b402e9bd6b28c4586543f8c4131f9d8f + last_write_checksum: sha1:21bba85f59699f5bf1e8497ecce35e67b70fcac0 + pristine_git_object: f3d2efee7277bf813f083016c499077f4c3bc474 docs/models/billingupdatecancelaction.md: id: db6ed95035d6 last_write_checksum: sha1:6781ff5f812623eb2d4c362ab478433515f16003 @@ -261,20 +261,20 @@ trackedFiles: pristine_git_object: 285e2a150969c9d4851f4c9acda6ad4acc313dd4 docs/models/billingupdatedurationtype.md: id: fd1bfb929148 - last_write_checksum: sha1:8ec9d61b93a2d43e2c0a92d6443e3549a4b1b255 - pristine_git_object: 7c827b0adae92780e78a609e8b74435bfd4fe603 + last_write_checksum: sha1:bed8f44bace7e7187c9a6510549b1a25e0893db8 + pristine_git_object: 29c75dda04da8317052ea821f1a2954a9572958e docs/models/billingupdateexpirydurationtype.md: id: 53d2632a7c8a - last_write_checksum: sha1:169c235d5787b866204d16f3b7c45bcb4495cfe7 - pristine_git_object: 8519f37ac175e94c0d9fd1ab11e88c990cdfc4c2 + last_write_checksum: sha1:7258e9d4c17f5966c6ceaa20e71963da5e77bfe4 + pristine_git_object: cf21b1895d1b383d88b984f4c62f881d11b8994f docs/models/billingupdatefeaturequantity.md: id: e799ad33bb5a last_write_checksum: sha1:e7a8868c59cd8c535cab4bc08fe8ec6773d29889 pristine_git_object: 086cc66c36b49bdf3d6d1d83df35bd5ac6ccdcdb docs/models/billingupdatefreetrial.md: id: 8173d9088337 - last_write_checksum: sha1:c18a80b725677c761f02d3bbab242b7918267082 - pristine_git_object: 352a83e611268b7e5a2924b196a87494a848eab1 + last_write_checksum: sha1:28bf45de46a11f845fcc0faf0b424e3d30ad1a96 + pristine_git_object: e9aabf27cab60f185f824e5819b7bd6df050e3db docs/models/billingupdateglobals.md: id: be51d630ee22 last_write_checksum: sha1:ebb2f51852f2b74fc04466c196cce1255267e576 @@ -289,56 +289,56 @@ trackedFiles: pristine_git_object: ccc987c410b54cdfd945b0a4c54020614b9d3e65 docs/models/billingupdateitem.md: id: 349869ec6344 - last_write_checksum: sha1:3e73a7ce1b0a2d2dbef2d12afe0adf03dff08cf1 - pristine_git_object: ac6389184c1cc78430902ff71ae514ae32711496 + last_write_checksum: sha1:010b44201053b60ee391bc6027a5a81cf5eb2f4f + pristine_git_object: a6caacfed13ed3e8e2ae75b8f6be2bfdc0d4fad4 docs/models/billingupdateitemprice.md: id: c461358e0385 - last_write_checksum: sha1:d8498bb64d4ab23f4fd267e20f544545ae58e59f - pristine_git_object: 4043279d9ff16b2a88c6acc39d507de4563b9111 + last_write_checksum: sha1:8860d87e4ac5bb8bb29270b6249109ca90b47ef2 + pristine_git_object: 91d83bb7c39896feff2c07935ebddb827cdb0d4a docs/models/billingupdateitempriceinterval.md: id: 0cec75e3f2ae - last_write_checksum: sha1:85b02b9549260beecced612b39fee9aef32ced07 - pristine_git_object: 80ca53524b0075bf0bdd881379ddbdedcbfa8f14 + last_write_checksum: sha1:23f7e1aeb4061a35ca0ef1008a182d58d48ce07f + pristine_git_object: 876d9175009bf7588f4c069b81e9eaa9ce8c13c0 docs/models/billingupdateondecrease.md: id: 1524bf987a6a - last_write_checksum: sha1:d2e0bb7f0bcdeaaabbed53f2f8ec223a7b0a73e4 - pristine_git_object: 05466b33014ea3c2d6d4642d0dcc87e55f947912 + last_write_checksum: sha1:61be180db7fdabd7c4deb67c479101c5a2d71d3a + pristine_git_object: 20bd4b901deaa9b626423150dd187ce2d81846d8 docs/models/billingupdateonincrease.md: id: f43ba81c2c74 - last_write_checksum: sha1:b7e284a5b94ca99abbbbdc2c39bbee7e4e64fe4a - pristine_git_object: 7a94a9e7564ad6936a84143d92dc20654b6d36fb + last_write_checksum: sha1:bde4ff3aac2375c4116af12c88c7a66cc7adabb3 + pristine_git_object: 2ae60a2cbc19c1d08f22485f371ef2eb49b3eab7 docs/models/billingupdateprice.md: id: 818c94761161 - last_write_checksum: sha1:fa19c3bf8e971ad64a6d727937e96928a98727eb - pristine_git_object: 86873ed3e9caf673d9388b3dea739a68103b1c83 + last_write_checksum: sha1:ae14a6d134768050b464398434169ad09422ea32 + pristine_git_object: cce87584eadac84d16fbdc148588a13cc731ca56 docs/models/billingupdatepriceinterval.md: id: 35fa4e54bdfa - last_write_checksum: sha1:65293f64ae16352471b6babcc9f46da9f6a86977 - pristine_git_object: 42d0f0bca1fb823b020066db7c384a30ac8d1eaf + last_write_checksum: sha1:f800390f9ff92064f4cfd8a7a9e1a974e9735ae7 + pristine_git_object: fef99c2a4d614825ca172aac2fbad7232f797067 docs/models/billingupdateproration.md: id: ceef03cb88fe - last_write_checksum: sha1:2d9da288535b8c4b16e23e6ef8a15c5ab36b3178 - pristine_git_object: 11dce03528cff9a27a669b273f946187ca261dc9 + last_write_checksum: sha1:349ef125fcb651dc625984c657e2b2904443fdb4 + pristine_git_object: b08ae1cb77d8adce2b494a8c9f8d82458b444e8a docs/models/billingupdaterequiredaction.md: id: 3f84a7bd8718 last_write_checksum: sha1:999727446d5c53ece4c816c145063ce6f0ab0ee0 pristine_git_object: 7c207728963bae9712cd13ca975761d9af3ba0c2 docs/models/billingupdatereset.md: id: 6531ed562ed8 - last_write_checksum: sha1:3330e53453711c977b09c535f50c4c832dfe9233 - pristine_git_object: d130ed741486290a30beb4d37939c2479439d0e2 + last_write_checksum: sha1:6c7b87ff391edea0f5bd0bcf14feca87ee59e212 + pristine_git_object: 39ab16e4993be894423a09a9d2b726b40152cd21 docs/models/billingupdateresetinterval.md: id: 6031d36eb382 - last_write_checksum: sha1:df1b0a77f44ff9e6e3ed6812914c5bb1fcb1750b - pristine_git_object: f44056d4412a65824f5f615982f3483e0ebf3cbf + last_write_checksum: sha1:eeebd0210c9acebb03067c6ecea686ae95569312 + pristine_git_object: 8fbdcfac41ad16f89bf3ff8bdaaebb2dfeabaa72 docs/models/billingupdateresponse.md: id: 61961e78dc41 last_write_checksum: sha1:3c7a336951e5b2349ec5f69ff87fba2f894f98e2 pristine_git_object: 1650d1362a2d40ee4a8cd4b42abfe98cad2463a2 docs/models/billingupdaterollover.md: id: f3584b1c04ac - last_write_checksum: sha1:32d259dcce9070c8ad34c419cb015f6e1758f270 - pristine_git_object: 3f1b8192232b56f26c0e210eb48b085b8c470dbc + last_write_checksum: sha1:985ed5263f51987d44da6d04c4ccd9569deebe54 + pristine_git_object: 5db81290374474c0b4d832010ba6d88194a72cbb docs/models/billingupdatetier.md: id: b3760261ba4e last_write_checksum: sha1:e2342a3d3b415a6be05d426f996863b583105d26 @@ -403,10 +403,6 @@ trackedFiles: id: 7dd074787f0f last_write_checksum: sha1:713343b986ce4734e32d9610b7ea4fed4229206e pristine_git_object: d41a6997c8fa42b8d2aba6ad2a63ad74af9ce769 - docs/models/checkscenario.md: - id: fde16749bb87 - last_write_checksum: sha1:d3dfa18b96ba6404b5d8d27d7a5e6d24f8bf70bf - pristine_git_object: a3439416a51f558dfa38fa46e6b0c1083f30dafa docs/models/checkto.md: id: dc4a2ec3784d last_write_checksum: sha1:d1b57ef2c9b13fcd684b22a9d7096f9aed82d60d @@ -507,6 +503,170 @@ trackedFiles: id: b48617bd07bb last_write_checksum: sha1:cbae35ce696b95160ace214ff4a3729e9bb31620 pristine_git_object: 6c35a4a0f2792209d946d20c80d30b2e024447fa + docs/models/createplanbillingmethodrequest.md: + id: aad7cd71a9d2 + last_write_checksum: sha1:1f2c67600db50f95337d7bf10c639e908c3fc303 + pristine_git_object: f29aef01df9f6dd537344c49f397a523c7501d9b + docs/models/createplanbillingmethodresponse.md: + id: b307da22d211 + last_write_checksum: sha1:3fcd6017bc7cb96ce77ca920fe451f9a4883a5c2 + pristine_git_object: 39cd257f0f31b76bcc61c394f1fe4bded4a0b382 + docs/models/createplancreditschema.md: + id: bda39f39fac9 + last_write_checksum: sha1:8d3bf3dfd849ce3112674c8108d75e77bbf40d92 + pristine_git_object: 77081dec474b563f70a69c44edcf5b6eddc6b342 + docs/models/createplandurationtyperequest.md: + id: e21beb31d05d + last_write_checksum: sha1:60840dd5ae3e89cfaa4c6ea23e8e5a604558a533 + pristine_git_object: 83013099132a30036afccf717a1c2c5d2b21bd23 + docs/models/createplandurationtyperesponse.md: + id: 1489338c4397 + last_write_checksum: sha1:0f119191f861ab525cfc3408963d498ead41c6a4 + pristine_git_object: 19341d579df11c5ecd96cd8f2997df9b81677719 + docs/models/createplanenv.md: + id: 7ddb245035c3 + last_write_checksum: sha1:8ac8cbf49092cb5887f4403fdad7b8bef8dfd247 + pristine_git_object: 0d52c5ca2a9e155d27feb55cc101f0b62c76d9ba + docs/models/createplanexpirydurationtyperequest.md: + id: 8bce768b39f2 + last_write_checksum: sha1:628b35272d8ce2add899c6c19aa96be3d2a42a0a + pristine_git_object: 54bb9e36c6284852b4ce37e4149abb49ba3481bc + docs/models/createplanexpirydurationtyperesponse.md: + id: 00879e9d2363 + last_write_checksum: sha1:1310562642734128d164b805256f66a2dfa1950f + pristine_git_object: e752ec9afd9d7423ad5a5e52bba7c879930e5a0a + docs/models/createplanfeature.md: + id: b48fb179ae52 + last_write_checksum: sha1:9b823d276ad5c6b6bd26d7802f91a83526c2f1f8 + pristine_git_object: 99f1efa6d4b3fe36778225cf98c44c2b5ec31cc5 + docs/models/createplanfeaturedisplay.md: + id: b054dc7d1bbc + last_write_checksum: sha1:c403d9befe4ad585ad4e9c3f56df01b8eceac7d2 + pristine_git_object: ddc08f080cdf1e983b82186d059b1feeb4d6a9fe + docs/models/createplanfreetrialrequest.md: + id: e90fd9226549 + last_write_checksum: sha1:26977ba8dba652edbd311ea47f001c9387accd04 + pristine_git_object: 33596856b4f27e2ffff3de4ee2efe383c74f6000 + docs/models/createplanfreetrialresponse.md: + id: 242cc60ecde3 + last_write_checksum: sha1:121f4f9e9e36a4dd7d3314308ee39a2aabb53bfc + pristine_git_object: c58c3903a0954d705b90c7ee285282d74580727e + docs/models/createplanglobals.md: + id: e47c231b853c + last_write_checksum: sha1:756ff3a30ec3c323a5efa5275659613a0f21d4d3 + pristine_git_object: 81491698e4974a1f693e7c03cde04586b18c60b5 + docs/models/createplanitemdisplay.md: + id: 89626fca02fd + last_write_checksum: sha1:05f65e8c7f010aa6480578396ee254417db4b421 + pristine_git_object: bd384b452456016555d00559f6b3dab88c1ea4d2 + docs/models/createplanitempriceintervalrequest.md: + id: 18e0dca1ea6b + last_write_checksum: sha1:f022dc04fb84189001d091aa855f585d0b912bc3 + pristine_git_object: 5ab2ea0a0a614abf498ef68a3365d1c64ac01613 + docs/models/createplanitempricerequest.md: + id: baaf8916c3b6 + last_write_checksum: sha1:ae5604ddf20d7cc5a2faa0b110aea7b7471c983f + pristine_git_object: 4f4033dae1a261fa3e2b98b59ffe8e083b7b27aa + docs/models/createplanitempriceresponse.md: + id: 569ccfab75df + last_write_checksum: sha1:17b2fa9f796d384d74dfd79e8346179185f5565e + pristine_git_object: 246e93d3de3b93781af4978209f9c69020ef704f + docs/models/createplanitemrequest.md: + id: 4165b6419b51 + last_write_checksum: sha1:121d57fe2d48ce3e2e1ef3462c312e0b5b22feaf + pristine_git_object: b2880ea3c51ccba369cc4fa3ec19ad485b492fc1 + docs/models/createplanitemresponse.md: + id: 1dbf51c9fd08 + last_write_checksum: sha1:b30be49b6c789558a4d5d434d1e8e5007e928ed1 + pristine_git_object: a6222412f67913ffffe90f8582bc5fd10d1007cf + docs/models/createplanondecrease.md: + id: 13e92221faaf + last_write_checksum: sha1:c384c642ec8b7025a2e0fc74166e2153e417c173 + pristine_git_object: f4f2fd1c2dc8703409e66dc667956032309a2536 + docs/models/createplanonincrease.md: + id: de4cf324fe3c + last_write_checksum: sha1:5ff8337e204975963b88911abe70e986a40f7006 + pristine_git_object: 32d69248af29180c404ad5b0343a963e276ddcea + docs/models/createplanparams.md: + id: 83565eddc151 + last_write_checksum: sha1:c5c0d98ab42288f632fb21f52e0b40b4906bc78d + pristine_git_object: 40a517b0486ffe1a5d7634059ac1f4eaddee6742 + docs/models/createplanpricedisplay.md: + id: c54110e927f1 + last_write_checksum: sha1:ea57765f6d0be4c8b0b85b928d10461584293df2 + pristine_git_object: c329aa588b3946be41c98de8407001fad94759d1 + docs/models/createplanpriceintervalrequest.md: + id: e2978f16aade + last_write_checksum: sha1:6a9bab6ba28f5b0b04f6343ddf478a3d0498f843 + pristine_git_object: 7d5a547c8168af9b4cfeba2fb9fa5c7b5c40a5a0 + docs/models/createplanpriceintervalresponse.md: + id: f872fc43537d + last_write_checksum: sha1:79245427f2125d009533d4e932cb7fbf13040539 + pristine_git_object: 3b55edf3fd8d2f74378fa8f4a7d126fba60784e3 + docs/models/createplanpriceitemintervalresponse.md: + id: 24549a1388a1 + last_write_checksum: sha1:2b92c1885222f908b45d789d0c35bc26f4f69fe1 + pristine_git_object: 505ffa29519c0299196f77893d21b1c03416ef1e + docs/models/createplanpricerequest.md: + id: f12e1c990ec1 + last_write_checksum: sha1:78d33eb36c61df233aeed99741f184760683cca8 + pristine_git_object: b9d8ba0d190ef6431423a3b93f937af5d714d1f4 + docs/models/createplanpriceresponse.md: + id: 23d4d42c22a8 + last_write_checksum: sha1:525d1bbbd2e1ed7a29a1729c9724082b7b54dc78 + pristine_git_object: 17a4e153d112cba35ca9b44b87359631cabe55e9 + docs/models/createplanproration.md: + id: d9de9e0fff5e + last_write_checksum: sha1:dbeb9ac733330c246d3ddecba924e80d9d6245ab + pristine_git_object: fefa0c8a14e9b08d8317fc8d3733dbb42f1dca09 + docs/models/createplanresetintervalrequest.md: + id: 0cddef9265c3 + last_write_checksum: sha1:4bf315605d9c46fc8aeae11e89708c8013b0fc6b + pristine_git_object: b2afd01b4d40951ec598280850b0fd3ee874c956 + docs/models/createplanresetintervalresponse.md: + id: b17cd3a6cba7 + last_write_checksum: sha1:b2d389267bac50ef73d4cf4afa23752778aa245a + pristine_git_object: fde9015d34005ce408769d28469ff9bd824fff10 + docs/models/createplanresetrequest.md: + id: 4269e3fff10d + last_write_checksum: sha1:81ba6a1a229a056e81142b59227d39db3a6b6f4f + pristine_git_object: 4a3159f5d66a2a2ad78a281939bd87e3633dcc90 + docs/models/createplanresetresponse.md: + id: 738ead8f3a77 + last_write_checksum: sha1:9ef5e1b8530a388284c4145b95eb22ea0bcd48fd + pristine_git_object: a2f64fdb4fadf6e25741034efbaa74019f88d566 + docs/models/createplanresponse.md: + id: 72de4e2745bb + last_write_checksum: sha1:bc6f4582c26073a6d033f7344d05b54609d80e89 + pristine_git_object: 53fb0b125037478d16d15ceb2d4aded62ed911d4 + docs/models/createplanrolloverrequest.md: + id: 01b2ca1d23fb + last_write_checksum: sha1:07c7b6cdddd4661ac8aabd4fa76801fd4892e11e + pristine_git_object: 82631b76135a8d3d16e8ed17632169b69f5d0b9b + docs/models/createplanrolloverresponse.md: + id: e8134e24a5a8 + last_write_checksum: sha1:db70d2fab44add601f2fa16a54f10259274a8dd9 + pristine_git_object: 1036a2ba0f28e32f48985255aecfa3bb52a0f679 + docs/models/createplantierrequest.md: + id: d21135e817df + last_write_checksum: sha1:efa6916e59ccfdc88ddadf70f4a6d88a4a52b179 + pristine_git_object: ed4bff7342418dd765a866de7538f0b0cc014c33 + docs/models/createplantierresponse.md: + id: ff3bdb303669 + last_write_checksum: sha1:9dabc7daf612eb7edd182042440c5df931625ac1 + pristine_git_object: ce4d81c7e579f7bb7e84c4cdcf0f7f1ccf74f156 + docs/models/createplantorequest.md: + id: 0da1b6839035 + last_write_checksum: sha1:0c2f734156145d11703794cbeabba0ff908c4333 + pristine_git_object: 3e3a233734b331c788f00925528265f0f1fe1fc2 + docs/models/createplantoresponse.md: + id: d83f8ec99877 + last_write_checksum: sha1:52b99a3b91c8543b6015ec69f417f29e21884e77 + pristine_git_object: 767b75b2664c8e1fc150756cd97056a20ecf283a + docs/models/createplantype.md: + id: d50ef0678a3b + last_write_checksum: sha1:70cd59b183f2e587a037bc5485453286d1a32dce + pristine_git_object: 32d3faf1d3017535673cf37297dc291ae3bf19d9 docs/models/createreferralcodeglobals.md: id: 368eaec7a9b4 last_write_checksum: sha1:abfc0223ac79b4ce82dc286b7eaec9ee7003a10a @@ -531,10 +691,6 @@ trackedFiles: id: dc88db3adc93 last_write_checksum: sha1:42f7f4090ec893457e1f58865a7499a419dfcf4c pristine_git_object: 8816de7792fb2034f720195e14f1324cbe0e67ad - docs/models/customereligibility.md: - id: 6ad6cc047223 - last_write_checksum: sha1:935d36a8ec3552a9ec1132543f6a236549060e1e - pristine_git_object: 2bd1c2088248cfd43d8ed713b8fc10f4222518ac docs/models/customerenv.md: id: 714d5f271769 last_write_checksum: sha1:0339c99475930033694fa4b6d63c9d0266596379 @@ -583,6 +739,18 @@ trackedFiles: id: d885b846d73a last_write_checksum: sha1:8f1a2df56569d00e4b715d63a812cbe7d1021baa pristine_git_object: 85b47392661a60bd09ae28ec0e96772f23933786 + docs/models/deleteplanglobals.md: + id: 100f7cb73771 + last_write_checksum: sha1:c6ccc2a4746240327588ac13dd3cdfd9a9f024b5 + pristine_git_object: b2b6e9e658a0550833e87f85a09ac1cc6765f336 + docs/models/deleteplanparams.md: + id: 1c1f19af9965 + last_write_checksum: sha1:080b393a26c701395c65b0317efeeab8209226b9 + pristine_git_object: ed65bf7e04072c09b09a557c9cd5fda25f24e878 + docs/models/deleteplanresponse.md: + id: a40d99b43bfb + last_write_checksum: sha1:479a949f37a4395bdc28c82eb5843e9ce2668768 + pristine_git_object: 613f5798f6c2590b44c3920b508ca00e5517585a docs/models/discount.md: id: 003b28f6c8a6 last_write_checksum: sha1:cd5a5cf9d11d6342a4d8f1d0479e158159852eec @@ -605,16 +773,16 @@ trackedFiles: pristine_git_object: baeb7ce122c10f3d16f5095e2068aa1a57b7dc2a docs/models/expirydurationtype.md: id: 7ba992bf53cc - last_write_checksum: sha1:012c3bc7b1084ca6f478f19b7606cb19479fcc27 - pristine_git_object: d73f4f219a02fe27c18ab0f923bacf7f99574623 + last_write_checksum: sha1:621bdda28fc13c065067c82524420eaa28628bdd + pristine_git_object: 80366277f5fd22322c89d13a38562877f09df7e8 docs/models/featuretype.md: id: 9fd6a7ea7659 last_write_checksum: sha1:e78cc7c19a8c81fe196161343bfa5a508572a13b pristine_git_object: b81adbcda5cd11189273956e2702422c649aa141 docs/models/freetrial.md: id: dc73eb37daef - last_write_checksum: sha1:c1789ef30367ada63ea75c3d2ccff9a6da3a8c3c - pristine_git_object: 8a319330306ea2ec52d9c5fd937d256a98c8a1d6 + last_write_checksum: sha1:0f8ee227ca42edfb64780b836e99518a340e3d82 + pristine_git_object: 589d1bb1e1cd47c62a789a8cff85528280df7e94 docs/models/freetrialduration.md: id: afd918f70308 last_write_checksum: sha1:55685a177c7e93c6a9806a7e7d0aa006276d9ac6 @@ -683,6 +851,102 @@ trackedFiles: id: 6bb57e046821 last_write_checksum: sha1:53a4bc89541b3de7bfd893b894c386deee187129 pristine_git_object: 438b3c3d032a0b57e9c72778ba797375ab8898b4 + docs/models/getplanbillingmethod.md: + id: 5899381c0e82 + last_write_checksum: sha1:93d35c83c757a6f8cc683ac6bbd7f84892568f37 + pristine_git_object: d8b089d97ce1e4230dcff81169bfca45d7f7fa36 + docs/models/getplancreditschema.md: + id: f70b7a9fd404 + last_write_checksum: sha1:1ad49c99400c9f9c735bf18686e2c7f3a0715803 + pristine_git_object: 1f3b4e20a81e527e25e2a9ee59df270faa84504f + docs/models/getplandurationtype.md: + id: 531b497ea20b + last_write_checksum: sha1:df5c7a55a41ba415e20ad5380cec7bfc25ac29ac + pristine_git_object: 5f29921945accc78755b28a5e69eb3e4a68acd18 + docs/models/getplanenv.md: + id: f83aac7b06d9 + last_write_checksum: sha1:9a144c5d18e790a681bc72ccc8dc7dff6604d21a + pristine_git_object: b8d4c39f8242f3bd334456658defdde380e31d77 + docs/models/getplanexpirydurationtype.md: + id: 03a36cc18dfa + last_write_checksum: sha1:8fbcd41010d7b858f04b035389387133fdfaaf20 + pristine_git_object: d127699651820a18616b4c971dd9488e96c07d3c + docs/models/getplanfeature.md: + id: c4414dd51a12 + last_write_checksum: sha1:0f89828767697ba0086bcce9cbe0024876ae2dd2 + pristine_git_object: d02645f41b0119e30c58808f89d5990cff236d41 + docs/models/getplanfeaturedisplay.md: + id: e2c9a51d63ce + last_write_checksum: sha1:922a22500b273037c48bf4770d7cb4b46afa7ff2 + pristine_git_object: c97bd24428bfe9554a9dd83b38a8588acf6e6d1f + docs/models/getplanfreetrial.md: + id: 54a3c6d13ed1 + last_write_checksum: sha1:1b05c07ec9198a8371658aafd95f3d4be434803d + pristine_git_object: b7217f769ca6c650fc0a9618ef79b94bc4b97348 + docs/models/getplanglobals.md: + id: d39b54bef333 + last_write_checksum: sha1:1560ae040a9ffdb3b4e0e76a6e66ae689923340f + pristine_git_object: 32425a06c43e822da2d6b6822828855d89eb462f + docs/models/getplanitem.md: + id: 81b2254045f5 + last_write_checksum: sha1:b3b38b738cec2aab0431484e9ef27cad75ad69a0 + pristine_git_object: e2e5067aa5bcc4ed77259466c68ac01486365888 + docs/models/getplanitemdisplay.md: + id: fe1e039f8a11 + last_write_checksum: sha1:d9b24c41bf0c7fd7d70104f61ff6018841552e96 + pristine_git_object: 6728190d3751f3fccc8e31d333b11846d5f6e489 + docs/models/getplanitemprice.md: + id: 1003fb6321bc + last_write_checksum: sha1:4ff69a5edf9fde75592208a3808564d44ca6c57b + pristine_git_object: 254d6ea5d5d414a8fbcff93813b9f4f226ace68d + docs/models/getplanparams.md: + id: 8196ff0c01c2 + last_write_checksum: sha1:e34b05d0e8edb4161d4a0fd1b3db44da16ce739c + pristine_git_object: e291baf6a9f05d697f44275bc279834537cd3bba + docs/models/getplanprice.md: + id: c4e50c128aed + last_write_checksum: sha1:903283644c4a6f2f17310474e3d5326ddc8806ee + pristine_git_object: ece95509a5ff2728e3ed7ea36a54b7e8ec4ed074 + docs/models/getplanpricedisplay.md: + id: ef72ec45d28c + last_write_checksum: sha1:c20fbc4e2a46361cc02eba4292788d278f693f88 + pristine_git_object: bcbad67a252e45ad1181c76834ea98b725ac56ec + docs/models/getplanpriceinterval.md: + id: 49e240107fc3 + last_write_checksum: sha1:46f284ab72a58f462848a006ea9dc26d944c59ce + pristine_git_object: 3370145b996fed00a85041e7c500c0271627c930 + docs/models/getplanpriceiteminterval.md: + id: f5a725b2b8d5 + last_write_checksum: sha1:b68a8c4fbaba805bc18f77116cdcb8776c267c05 + pristine_git_object: 4da7249fe8ada0c78fdbff11f1d2e57e9edf15c9 + docs/models/getplanreset.md: + id: 0d4683eac10d + last_write_checksum: sha1:014167206a4a206315d9530426cd4d21903fbe90 + pristine_git_object: 2ad13f83a372f25f8322245dc743e9c78114097c + docs/models/getplanresetinterval.md: + id: d518a38e6124 + last_write_checksum: sha1:1461a586f2956642f3ef7fb76697805710cc106e + pristine_git_object: f89ea0c6427dda0e3791eeba61089a4bb4f2a3d6 + docs/models/getplanresponse.md: + id: 2b0a620fdbb6 + last_write_checksum: sha1:ab28211dcdcb7a81a29de258950533a965fbfb88 + pristine_git_object: dfb53b24df9909e36f22d356df255d5e6833c066 + docs/models/getplanrollover.md: + id: aa86ef4ae999 + last_write_checksum: sha1:1efa4540b76a45e1fba1711618405c9627e57a56 + pristine_git_object: d6778e26ece0dd751384156f2417e3a87b435f7b + docs/models/getplantier.md: + id: 25c80d2e311a + last_write_checksum: sha1:a305e103382fb25f143faecd407b0cde60b5fce9 + pristine_git_object: bf914d4d767d05441d7416cad9014bee873f6287 + docs/models/getplanto.md: + id: 4370b94fa94c + last_write_checksum: sha1:8a6c9aa8e0f1b550e9d075188dac724bf555adc3 + pristine_git_object: 954d44b1ff659f883d67c701b0eb00f8e8d99419 + docs/models/getplantype.md: + id: afbdf26f0f4b + last_write_checksum: sha1:7b11bca3ac08a5bd951768af39bc5a2d2867a1ac + pristine_git_object: 64f5d61046d023c2293fa50994151408e0ddcd06 docs/models/includedusage.md: id: e844c6f90fe1 last_write_checksum: sha1:f45eadc2eb0f9f2543fcfd3b0d671c8fc9e1c5a8 @@ -701,8 +965,8 @@ trackedFiles: pristine_git_object: 89d5fc51af2af3c3ac46c8b30c6daddf2748c444 docs/models/item.md: id: 40dd7473ab87 - last_write_checksum: sha1:c62c2a087d0804857bd131b1458b72074a2c407e - pristine_git_object: 46f65fabed9a5a852350d4bce4f036f73fab0438 + last_write_checksum: sha1:76b0d2926283b9d9cb79c92fc0c1baec458f06af + pristine_git_object: cfe1e33316af7bc0ca8cca5ecb59e72e5f3182bd docs/models/listcustomersenv.md: id: 4a356fa1f33b last_write_checksum: sha1:e883c9c38a73b9910ff2cbdd6adef00b226ff214 @@ -791,26 +1055,106 @@ trackedFiles: id: 38d27c59e570 last_write_checksum: sha1:f53f04cb15375a2b0f35914aae8492ac09017fbd pristine_git_object: fbbecc4872d8313dfb7097181436b0459abbb29e + docs/models/listplansbillingmethod.md: + id: e3bc081b1871 + last_write_checksum: sha1:6dbd9106af5281ed0050a6079d13ac94a3be55c5 + pristine_git_object: fbfdc8106d7c545f591ccb1580698953c01bfd6a + docs/models/listplanscreditschema.md: + id: 8f4524699ea8 + last_write_checksum: sha1:8264d803e53a657b5077baf27f79e86b9aca6c1d + pristine_git_object: b956d783f8935b18cea46b9c4fde2329141cbf96 + docs/models/listplansdurationtype.md: + id: 9495db2c46d7 + last_write_checksum: sha1:0d6fd83d4998c2a27143e76d4b1b4126e4038822 + pristine_git_object: d717ad36f08313dd30dfacf50f6c006c70eb3141 + docs/models/listplansenv.md: + id: 31607dbe25dc + last_write_checksum: sha1:9830f7348ee862987f13efc4a01eb6a6796ede7a + pristine_git_object: 02c29dfc73212a614b5c8ec44f720bae159e389d + docs/models/listplansexpirydurationtype.md: + id: 95a054c2e519 + last_write_checksum: sha1:584ed1565d5e0e1526c1972a6f260a75b57b6635 + pristine_git_object: 1a2b7ca1f74cbb6ba3decaf7c4589617d3f530f0 + docs/models/listplansfeature.md: + id: 695e022227fd + last_write_checksum: sha1:be788a1a590651cc99265529af796851f8295b7a + pristine_git_object: fdd24f74545529d350a107b5d3385df187f443f2 + docs/models/listplansfeaturedisplay.md: + id: 428730a6c6ac + last_write_checksum: sha1:4e536b7fa21ccdc8fdbf8bb6ffd0c27ff0ffe648 + pristine_git_object: 3db729eb140b76ab3fea76d591911200a404e8a5 + docs/models/listplansfreetrial.md: + id: 4907e0f32173 + last_write_checksum: sha1:a26ca3277bbf6899e7c6f1677e90348cbc28a342 + pristine_git_object: 9db93e0a430886d3930c30956ae2c935d710dfc9 docs/models/listplansglobals.md: id: 4f3f31fd5f30 last_write_checksum: sha1:d0a5b30f29ed4b26578d1ade3e8fb8e271021f66 pristine_git_object: 846b045cecb95bdb320cce5aa34e77eace103dc6 - docs/models/listplansrequest.md: - id: dc56a693a9c6 - last_write_checksum: sha1:bada970f584abc4d98db4507a9a6580dccc3c829 - pristine_git_object: c6cd640e113790b85283ead095606d7fcd7e6609 + docs/models/listplansitem.md: + id: 2d387d07baea + last_write_checksum: sha1:27d710757eb147f711c82f25c62b837283984d7e + pristine_git_object: d2b69ffefc657bf064b942c2403f2ab34fcb814e + docs/models/listplansitemdisplay.md: + id: d3d6c1432639 + last_write_checksum: sha1:9ecc694aba3c755c868fa6c1d735ab6442d7fa85 + pristine_git_object: fed159e8337df81138a81885b73bc60eb9b2268a + docs/models/listplansitemprice.md: + id: afd054e4c901 + last_write_checksum: sha1:3ff0e385d84092f66817f4edac5d9bf4da444124 + pristine_git_object: 844908867174e1001b0f3501987546109eec6bac + docs/models/listplanslist.md: + id: 6e9f463afde9 + last_write_checksum: sha1:6695cc81a5ac26ee900bb3486145aaa327e463a2 + pristine_git_object: 40d160c5177b014dad186e2dc3fb52bf249d6225 + docs/models/listplansparams.md: + id: 585ca32cddb9 + last_write_checksum: sha1:ea218ec174d08b0a4ce981e60dbc40f311e0fc43 + pristine_git_object: b78c6ee19bd7cb221af5a2142e16502fc682c356 + docs/models/listplansprice.md: + id: 59cdbe6edbb3 + last_write_checksum: sha1:591f25ec3a2065341363c6936a161fd2f996f30f + pristine_git_object: aa0e6c4b7f5ab12cbcd8912b3f8c73f2112fd676 + docs/models/listplanspricedisplay.md: + id: 75ae01cfb731 + last_write_checksum: sha1:35f7653153b747381e56c29aab3be1f633b6fc9d + pristine_git_object: 183984624f5db2fa0531d6315e3a0992bc4c5bb2 + docs/models/listplanspriceinterval.md: + id: c6eed8ecd3ab + last_write_checksum: sha1:a406660a86cea1ca01551fde8bc67a6692a79322 + pristine_git_object: 2a8a39f8ac58a6ab975be8c95656e259b4acba31 + docs/models/listplanspriceiteminterval.md: + id: 01ecfb4227c3 + last_write_checksum: sha1:43ad14ac0b516caa6d79c4754be679cbeb13eeca + pristine_git_object: 9f629477abfff58f81bc131cc219559bb0696f83 + docs/models/listplansreset.md: + id: a094b1e8ad88 + last_write_checksum: sha1:f393e47631d54b7ca392f89b6b8dd298044cafba + pristine_git_object: d2d1fc44a5a802750cf3579fbe14acfa81d62705 + docs/models/listplansresetinterval.md: + id: d3e52a6a7150 + last_write_checksum: sha1:0cc22e923ec5a7af4e9c5a34accc5be12d97a1ce + pristine_git_object: 3801f20f4a7442df7a92c79cb4391189da06b9a7 docs/models/listplansresponse.md: id: 36b6e3fa6daa - last_write_checksum: sha1:f7fe5c2aca78ca13ef988e37e35180e1c4a141d7 - pristine_git_object: 35e5ec6c28f97b8551ceb9eb31b5b40894618ae4 - docs/models/ondecrease.md: - id: 64eee91e295e - last_write_checksum: sha1:999ea60fe26a7b5c4e4156ec56df078b883168a1 - pristine_git_object: 6303fefe338899d7d06e5f060715e1a40fdad6de - docs/models/onincrease.md: - id: 1c1351190e30 - last_write_checksum: sha1:c42371e97c1eb94c4ce8c7b316f0a4eb33f06020 - pristine_git_object: 39c4dc445027afe9bbb96efa1142f6eec8a90ebc + last_write_checksum: sha1:9763e11551ddedad472de9cbce9e6751752265bc + pristine_git_object: 0849fd982df773db9c7b1ee9d432d6c0e3dacd9e + docs/models/listplansrollover.md: + id: 82ea7a9e4345 + last_write_checksum: sha1:38eab435cc89ad8b2d2877e6bc83d26b11cbfffe + pristine_git_object: b1465a838739806bf638ee8507880d90d397724b + docs/models/listplanstier.md: + id: 349f4154ddda + last_write_checksum: sha1:81d42f38df41ee6b337de06ced2a4461ef6b5936 + pristine_git_object: 01472ab682d460e78f51d7e759a98b767e6fc88f + docs/models/listplansto.md: + id: f5c4d5fd869e + last_write_checksum: sha1:8bbc02c32db22255d8cc9b70f3e0a809ea5e1553 + pristine_git_object: 032fa3f4f627c14fe113d73ce7f805b02f5a2e5a + docs/models/listplanstype.md: + id: c265fc1d3752 + last_write_checksum: sha1:fee41af7544896b624de7a39fd20dadcf73d8dad + pristine_git_object: f5cdaa931dfd1225fc6e7e45b4c7df54934a462d docs/models/opencustomerportalglobals.md: id: 9672e1095d8f last_write_checksum: sha1:128710c47318a46258c878691506ae599d1b55e3 @@ -825,64 +1169,68 @@ trackedFiles: pristine_git_object: e837aa4e197e0d89a5af163eb58863349124e4de docs/models/plan.md: id: 900c4149ef4b - last_write_checksum: sha1:be5c12df8e68ea9d232716b1b2ee5010830f0051 - pristine_git_object: e57ad90418971bb25b6166c84d74cac8c66cc9b6 + last_write_checksum: sha1:068e0c9b7aac6a13a6c7f32998676003732329a1 + pristine_git_object: eff391298bf05283aefbff6562e18e8a6295c4e3 docs/models/planbillingmethod.md: id: ac90cee4f6c5 - last_write_checksum: sha1:09b695044d92084978297b9e878857938bda8366 - pristine_git_object: 94bdd58e5622f19d29267d15f91f96ab6a9679dc + last_write_checksum: sha1:30a815d6adf61aea6127d9edb4026936d13a4250 + pristine_git_object: 4aa20f7a70f16a7f437aa35b04841d8d4b19780a docs/models/plancreditschema.md: id: 510cd9d4f287 last_write_checksum: sha1:3929c72df37848348916c755926dd1de7c252b3e pristine_git_object: bcf7cd000ef324a7eccf32e58c7195627bf19a29 docs/models/plandurationtype.md: id: 7eb9a5f1eacb - last_write_checksum: sha1:a0b5b8d9066dd79472e2abf269e73c8b4a7f3e06 - pristine_git_object: f3977f1f0ea875c5bca2f2c4e10dec923ed7d762 + last_write_checksum: sha1:81f41818daf55dd9dadc8e14e383ad2e62804905 + pristine_git_object: 251f2b661e3a9d65612ac18f0779bc04f515619d docs/models/planenv.md: id: 0e584adaa5a5 - last_write_checksum: sha1:62f06d32c624064b18ee6ebd2fe1fe909cecf237 - pristine_git_object: da89cacf400e948cbfcc677c541918736473b531 + last_write_checksum: sha1:1afd6a72ed0428e605f36df7a4c8f7f24c728686 + pristine_git_object: 2357a78eff239943e206394ab2884612b88fd5a0 docs/models/planfeature.md: id: 81977f66cb0b - last_write_checksum: sha1:cf6db242844d29b27ca19f867e73eea070c341de - pristine_git_object: c479f36668f0567d0c416ffbe3ec9ed401b32c9d + last_write_checksum: sha1:22bc5373900e56f572d8e2e564bc9bbb6e5967f2 + pristine_git_object: 209c71d992fd64e720b2aed64c50c2efead92c85 docs/models/planfeaturedisplay.md: id: 908c5ca1099a last_write_checksum: sha1:c1982d171a3999e1c83a99be9982c4ce3ef15536 pristine_git_object: 284fe56845860186ce7c1c90b884a4f80f254e1a docs/models/planitemdisplay.md: id: 6db1198fd6d9 - last_write_checksum: sha1:13f52a3a5094e50665ca0960eb3b4722be465d5a - pristine_git_object: bb425df1d9354c92a787a6ba1e567e62919d01e9 + last_write_checksum: sha1:b57f59dc779de4d6332e0ea2742839587edef9d9 + pristine_git_object: aed40400dc4b6c589ef8673f84dba763aa7588b6 docs/models/planitemprice.md: id: edd9119a1319 - last_write_checksum: sha1:c10d8096918354e9df2ece388264d6c5bfa8ef4c - pristine_git_object: c4e45c975c0823c49a86cf28b7a4914e76eb5ea7 + last_write_checksum: sha1:61e15369327937c6e43110b90e81ee15f3a48f5a + pristine_git_object: ed5a320d62544934f6e70586dac5e21dded3f558 docs/models/planprice.md: id: 70699ad0c942 - last_write_checksum: sha1:c702e81781b4b1d5d5603f2e76b2f5508ae7f75c - pristine_git_object: eeeb9a00faedc9d6c3a7fab4c6274d1a1c93e2b7 + last_write_checksum: sha1:c883ecfef57751ded74a650fd1fc91bf9d87ed4c + pristine_git_object: c5b23df2f589d4d239a9a96d02c72e86d109cca0 + docs/models/planpricedisplay.md: + id: 289f232afb2e + last_write_checksum: sha1:b786b9215e1b9ab5758e1255652ec57175ae74cc + pristine_git_object: b28dbe1c0b38e63dcabf1d16b2265b5a97d2665e docs/models/planpriceinterval.md: id: df92467f108c - last_write_checksum: sha1:8c8f89dca32c55f76f4e12ed727df06084bea8fb - pristine_git_object: cffc7ebbae9212f37a11b842333e92214ca21320 + last_write_checksum: sha1:6da158925940c2762a89484fc02a197a45b84846 + pristine_git_object: 3c6bfe6cc9f917cfb28a90085e265b3b5a103584 docs/models/planpriceiteminterval.md: id: b41d93ad5140 - last_write_checksum: sha1:d2f0067b5c27f8b6759084f9f88d42b16fd38624 - pristine_git_object: 28d2bb1ffbb881a378ed5a5ca9b03d028299d046 + last_write_checksum: sha1:33f6566c42e361d3398e74011ea043ba92e27e61 + pristine_git_object: 6cab31656b0f63c55b9aee19b6f8aa3eef2b59f8 docs/models/planreset.md: id: 08cb2753f6e6 - last_write_checksum: sha1:6f73e545b179866a81ad746b2bf1b5f1039da727 - pristine_git_object: 13eee8120fb853374a525631049ac13954ef2c80 + last_write_checksum: sha1:aa46714be96b570fdd130828a57235036711aac1 + pristine_git_object: 03a0310de42bc4e702adbc197316ee0df9f31322 docs/models/planresetinterval.md: id: 1d0c7c8f25db - last_write_checksum: sha1:21bd652be1344c91d4492448f3bea12e3d234487 - pristine_git_object: 0d028f3dfa9b3ffe2aa2c5ba750811e20009cf09 + last_write_checksum: sha1:e37a9e1141c5c4c9a398d5727e967cc7eab65203 + pristine_git_object: 0612c99bc608b137640e93683b223efe0a2ffed7 docs/models/planrollover.md: id: d432fcd32015 - last_write_checksum: sha1:f1bdfda2727529076d221f4ed0682dcd9899eeb6 - pristine_git_object: 61e6fbec44052b3197a543f27c05c28a54b91917 + last_write_checksum: sha1:6a9d0e59d5e260cacebab72874b6f9b52cad8269 + pristine_git_object: b24a347af2dd3725b201c0228c293c07296ad436 docs/models/plantier.md: id: 6c3492fd8bbf last_write_checksum: sha1:b157b295184794131b0a9764e7a82dc518602e9b @@ -897,16 +1245,16 @@ trackedFiles: pristine_git_object: cf233509e8cc1599a589dba1e68dda9e2d16400b docs/models/preview.md: id: ca71b601ef12 - last_write_checksum: sha1:7f28aa6fa61d2909afea263220c1db6760e36683 - pristine_git_object: f1c2dbfbebc8e6e6637734d03a7c2afbde7f8c39 + last_write_checksum: sha1:40aa929c88e329add6e7ca46d7a8a2035a292320 + pristine_git_object: 30f2fde544d6369ffb95e242d86285de93ba6877 docs/models/previewattachbillingbehavior.md: id: 09c5ce0d8d6a last_write_checksum: sha1:c8760159f7391b802a88614b3c02804ade44f538 pristine_git_object: 939760d3cd9da80372692bc08c6b3ab4297249de docs/models/previewattachbillingmethod.md: id: 4fbccec2190f - last_write_checksum: sha1:db2792398eab54958aa78abf007fa72d8f89e1fb - pristine_git_object: c7a69be0d40aac6eb2465c1b06c4a7bb8542c512 + last_write_checksum: sha1:39e5c7556d0f2739d994e97698da4a0dba485cbf + pristine_git_object: 1646686d9a3177cf398ce904346a810566c681f7 docs/models/previewattachcustomize.md: id: dd921922e55d last_write_checksum: sha1:c75797874cd1c1f49c76a300c872148c85381837 @@ -929,20 +1277,20 @@ trackedFiles: pristine_git_object: 3a363e45f5bce3e2a6003110e064642c55c88a55 docs/models/previewattachdurationtype.md: id: b41ef967b1da - last_write_checksum: sha1:0895f81401758ecb3e44b109ef38b3a47ca597cc - pristine_git_object: a995bff9fde526220247a3fe1051e5f7acb698c6 + last_write_checksum: sha1:fc6a07373e3dfeaa2d6232479146ffb8b1ab0881 + pristine_git_object: e9584b37ee5121b526d9dde85fef8232ee5f30e0 docs/models/previewattachexpirydurationtype.md: id: 0cb588a15167 - last_write_checksum: sha1:c45dcada80fff7070f8dae33fb2dba41eb25527a - pristine_git_object: dcc75b0986beebc6228ffa55f0c9d2f3e30ad540 + last_write_checksum: sha1:e87687f7de9a6c1e425ed3adee650ce2d3ebc445 + pristine_git_object: 1ab76bb0e863b774266c81ea67f8fe98842deec5 docs/models/previewattachfeaturequantity.md: id: 804680b3b212 last_write_checksum: sha1:5dd6ad14c85d1ee911cd899b99665aad96fee7b0 pristine_git_object: 0a07754963ad26331deb7b6f43700d2f4523f234 docs/models/previewattachfreetrial.md: id: be20be37a533 - last_write_checksum: sha1:8187497f3df0e0da0879aae8f5ec4907a76434fe - pristine_git_object: 54d2be4ee342262296121187af95a7b6632548de + last_write_checksum: sha1:cc8ccce8ef5686e5d3d61619c26771abc66a52ab + pristine_git_object: 477a1644820da7d5d5b0847a68a9cc448bea6c9b docs/models/previewattachglobals.md: id: 1d1254f22011 last_write_checksum: sha1:af824b094366d657e9237154a259f003e33fcea7 @@ -953,16 +1301,16 @@ trackedFiles: pristine_git_object: 52153f9fd9a587fd6e60b8ee15bbd9e661d7bb3c docs/models/previewattachitem.md: id: 6379edcacd70 - last_write_checksum: sha1:88dd1e97457ba09d8ea2ce38ab5d26ff55d6bfcc - pristine_git_object: ced5afb0b8d03ec950720422cf3ef24383f23fec + last_write_checksum: sha1:048a25ae3952c46371b53dc4fccd3b884414c0f2 + pristine_git_object: e172ba71a57cef46d0ebbec9403d1de06fed115b docs/models/previewattachitemprice.md: id: 7b4a988d6e91 - last_write_checksum: sha1:82849c9fa903759fff6d95e26add943f7b873c3e - pristine_git_object: 09404c66b6d85e85e01343990f0486cd81465ce7 + last_write_checksum: sha1:1c5025f569bbfe7c5d3c714530c9060d5f8359be + pristine_git_object: 8eea11a0da99573014c6fbf0488211b7788a783c docs/models/previewattachitempriceinterval.md: id: 96eeb2602066 - last_write_checksum: sha1:aea5233836aef333631b9d072b971c6a8750625b - pristine_git_object: b258bbbcb635ff50af0ea0cd26c80bf9c2b6e5fe + last_write_checksum: sha1:dc3892f6e3cf2aca0e20c16f12972049b1dd9c5c + pristine_git_object: 7ebceccacfcc32aa5ad5eb937660ef3739ec7f82 docs/models/previewattachlineitem.md: id: 3411ba3438a0 last_write_checksum: sha1:73f694348074e295cd7da51fc35395861480b281 @@ -973,12 +1321,12 @@ trackedFiles: pristine_git_object: 4e08b05107b8054ee8f00d0b2d35355a48ff47dd docs/models/previewattachondecrease.md: id: c3d14ec84b6b - last_write_checksum: sha1:9b530aca7b1f6dd45da0531d6e65f6e95d36cdbe - pristine_git_object: e092b88fd5bf210acd613f92a6f0b14967a5596d + last_write_checksum: sha1:c98eabf793906b34cf479e252ebb67d61a590999 + pristine_git_object: 6d8552af77f228f5f06a56035fee0e711310d94a docs/models/previewattachonincrease.md: id: 62e686313af6 - last_write_checksum: sha1:8640813c8a0aad7698ebd5099453d09aeede940c - pristine_git_object: eb0441c2db8ec4377d201ef9a09ce9cb1d4e45bb + last_write_checksum: sha1:79c9eeae5214b2e2d4800667d6b188537c7f46ee + pristine_git_object: 2fe65b7ad59a16fa648125ced2c2926f5ecbb8b9 docs/models/previewattachparams.md: id: 3ba40d589e3d last_write_checksum: sha1:28bea601bb1fffcd4b1fae63b31e72527e24f100 @@ -989,32 +1337,32 @@ trackedFiles: pristine_git_object: 7551150c582828b16198182257edd1605998c2b7 docs/models/previewattachprice.md: id: caa899534556 - last_write_checksum: sha1:72978279e5c185eef349fde7c7d17e38d3be0d48 - pristine_git_object: ccc415e76147573bc6d1109e6e7eafaf03c07b8e + last_write_checksum: sha1:9739aba6fb58cf4de4e39a307714bc35eea8ca45 + pristine_git_object: 1f92cf42716995e3024abd5e6b7be258ce8fcc70 docs/models/previewattachpriceinterval.md: id: 922bda88e1d8 - last_write_checksum: sha1:1c10b919cc8232243d4c7b3ada3e31c8b3ae7dc3 - pristine_git_object: 9d9ee86de6685602a71bcf5ff62bbdd8e7a17961 + last_write_checksum: sha1:8e38cdd00dd58a77eb13cb133c4f5b31d865659e + pristine_git_object: 052b4f55f00c37535e83043f2ff325f09ffba1c0 docs/models/previewattachproration.md: id: 2d9f5cd09535 - last_write_checksum: sha1:1541a867d86e6862f4c14ded80b27804bfe0b571 - pristine_git_object: f7f7fb38bdba497658f9b9948b29ff3025bee260 + last_write_checksum: sha1:c92886c2a07120bd7c0750baa33f62352a8ef3cd + pristine_git_object: 86fef8897a946a21a11d01bb7ef680ef4d5a689f docs/models/previewattachreset.md: id: 8a677b69d681 - last_write_checksum: sha1:92be47fbd32e9b9b099b82d5cf9dda04e483c020 - pristine_git_object: 2d89267d69b6333f2a858144fee9f236680102f7 + last_write_checksum: sha1:441c2f04c2ca1f41a7e0251a2cf448fa63b4df92 + pristine_git_object: 9f0dbd39952d86ed4561fc5cf6f573cca79b9221 docs/models/previewattachresetinterval.md: id: 62df338dbcd1 - last_write_checksum: sha1:6c8ee26b2e4dab12fe1946d30be5fae9d4d811d1 - pristine_git_object: 85e80bbd0e724b8c56351d5e8be8965e5e2b8066 + last_write_checksum: sha1:3a48a841957e79e2dca7307a4b7222f84bad1732 + pristine_git_object: 3e9b1be359f8832c3439cad7e04566bb40ceaed1 docs/models/previewattachresponse.md: id: a678e8dbf94c last_write_checksum: sha1:54a4284030d1a1049310d4f7572cc7466789097c pristine_git_object: 4d5b7e88b2b41c7041dac45742625363b3ba2ac3 docs/models/previewattachrollover.md: id: 8ef3a1be0fed - last_write_checksum: sha1:638d479c86d684eb6a1f54a945b20e795b43a86b - pristine_git_object: 35b9addf8d56f461d1fd3e8872f88e8ee194a1c1 + last_write_checksum: sha1:d2cf512026309abaf59ee66a3fa2150db0b7fde9 + pristine_git_object: cdde9832cc438216f32f4525f91aea00eabf0935 docs/models/previewattachtier.md: id: 00f2ee21bab6 last_write_checksum: sha1:7e0040a68f65874b1590c0d2a7970904962cf86a @@ -1029,8 +1377,8 @@ trackedFiles: pristine_git_object: 622030b6784036aedbcc08c688621e5abcedb33a docs/models/previewupdatebillingmethod.md: id: 1d817ab2aabc - last_write_checksum: sha1:a0391bbb82f4b2a5a0c91e4c7b88e8b82f1c880a - pristine_git_object: 07e5a9ad4b8847b5ece98d1a3826f1b1053bedc3 + last_write_checksum: sha1:d7eb39bc6e0796792c173162dbcc17b37bdec535 + pristine_git_object: c8f89cb2d5e4d8003fd01c88a0d27bb11a766a7f docs/models/previewupdatecancelaction.md: id: 1159f8f85008 last_write_checksum: sha1:ad6cfa08615dffa789adb8e42f63ca30ea353582 @@ -1045,20 +1393,20 @@ trackedFiles: pristine_git_object: b1b08d33b6d81b31a1dc6dbd5c237b62a7a00378 docs/models/previewupdatedurationtype.md: id: "791319033460" - last_write_checksum: sha1:a82bb2b832db4b07225e95cfd6d9dfe357813f6b - pristine_git_object: 260c788c7d32441e933229dced472b96e30eea09 + last_write_checksum: sha1:49c51941f13f003c3fdb5dc94030bdc9202217f7 + pristine_git_object: 8a52c0c6cd095240f50bfad29a802c3485c59504 docs/models/previewupdateexpirydurationtype.md: id: 6d5273579d32 - last_write_checksum: sha1:29f071ab93ba52a315e56fa0259223080321d188 - pristine_git_object: f48ebd5a75a921d97ae8176b070a4a4a08c4b3c4 + last_write_checksum: sha1:18c52730d9304d9ae75a1f8e8506a687b4962690 + pristine_git_object: dd5866b2538407dbbe1274f8a38edaf9597f85ff docs/models/previewupdatefeaturequantity.md: id: 1a7b1eb62760 last_write_checksum: sha1:993c835c3b52471406b06a537de9e4076fe3b28d pristine_git_object: dbc2e272365a240b9a140615712c5f19aaa45fdc docs/models/previewupdatefreetrial.md: id: 19ddddb2bff7 - last_write_checksum: sha1:2294896c016b7003fb3cc8302d0afaaf29c887cb - pristine_git_object: 195d54bc5a4f58e9e028e77da8483d8272151bef + last_write_checksum: sha1:8963115ac8e3cf8022c92c1ed8adbfca2aff99ee + pristine_git_object: 6460e34c3aa99dcd15d0065c51bd1ff3f437f56b docs/models/previewupdateglobals.md: id: a81a391378fa last_write_checksum: sha1:f9b2ec90174de287754c0a935b4d90ec26e680b9 @@ -1069,16 +1417,16 @@ trackedFiles: pristine_git_object: 7210d48c7d789b0e78753c7280072daccf611894 docs/models/previewupdateitem.md: id: bf05ff6a756e - last_write_checksum: sha1:1117e78ac52b0172e7c02cfb16f850d49e684bf3 - pristine_git_object: 1afdeceab788e4b9c3c64b50de99a97979d38fba + last_write_checksum: sha1:20066e6ef28d8a4c4169e59efeab5195b9a33609 + pristine_git_object: 3bc6fa1666c42bd68ca1ceec1bb7b1a484cdaf07 docs/models/previewupdateitemprice.md: id: f033f2f9e545 - last_write_checksum: sha1:860aa0bbe3da1474286b0e0a48f07e5f450574f3 - pristine_git_object: f699b1b9cedd3ef83a62f0c02d4bd5f84e990bd7 + last_write_checksum: sha1:40196c72303d1029cad836de8bfb6674fa0cbdd2 + pristine_git_object: 5542db823cbba3604f78c171c3e3712f2d615b1b docs/models/previewupdateitempriceinterval.md: id: 5317a2333cd5 - last_write_checksum: sha1:5e48e6a011f37bbfb72d1144020168fac923b7b9 - pristine_git_object: de9ace7df7b3578a41bcaaf34751543d3de77878 + last_write_checksum: sha1:783ba76f51c898f9fcfb9fc9cc9c0c681236fc56 + pristine_git_object: 4d03b6784e60f4848254431479f0c6af337aad0c docs/models/previewupdatelineitem.md: id: 74e43e80addb last_write_checksum: sha1:264d2395850ca74deaec3a20f3be08fe5f0a9343 @@ -1089,44 +1437,44 @@ trackedFiles: pristine_git_object: 5a571a97da6b7e13d6f9186ebaf35c99800239a9 docs/models/previewupdateondecrease.md: id: a9a3f1b4aa0b - last_write_checksum: sha1:a33575feeac05a2862a0501a43b1d0f89a1edc18 - pristine_git_object: 418b15cfe444ad6dd04cb07a510472afaea12207 + last_write_checksum: sha1:2aad8132e9e21f2ca8260e04df4811d8c404cb69 + pristine_git_object: 1ca348c8d2f4a676d111a18d74ac9d216cc84500 docs/models/previewupdateonincrease.md: id: 391e207385c1 - last_write_checksum: sha1:fecb7d926d11dbb12b78f1ad9dd279748a338ada - pristine_git_object: e3e53e3b79050287f10c22d8570763e5604fdfc7 + last_write_checksum: sha1:f8d0c7936a1260b5d0dff01f8ce55e2407ed1c24 + pristine_git_object: a36f192fcdcb7733199531049b545b65609b7d50 docs/models/previewupdateparams.md: id: cf952c2251de last_write_checksum: sha1:bb62c866742031b9be3013e4e2d82effccaa8660 pristine_git_object: 46a76e5aca764349abfeec343ca664f81e363da4 docs/models/previewupdateprice.md: id: 4f88cb79503d - last_write_checksum: sha1:1125a1f2206b2323601d8546e2d215b38ee4795b - pristine_git_object: a0c8b350a937439c4ab0bc614056f0ce832f840e + last_write_checksum: sha1:c97c7b38eb64407e9bdd31f264abda070502a5ef + pristine_git_object: a2db72e18502ca69d29e6b52be45b6d63e7cfa7d docs/models/previewupdatepriceinterval.md: id: 300f908b2503 - last_write_checksum: sha1:0b78b7476af3057e4372b9080222b5e9d9b7f7c6 - pristine_git_object: 04ed4b0060ad5ff8b566ad20e121903c1e8e13bf + last_write_checksum: sha1:9c8866732d1777ff53a167166429c484d451c997 + pristine_git_object: 14a103c8e7e3ee88d61dbd99759a9f803d14ef8b docs/models/previewupdateproration.md: id: c3e1d3131ff9 - last_write_checksum: sha1:52260fe6aabfad18775567968330e2e6d9f10bdc - pristine_git_object: 36d19f6f8ae0c7961a90771c9a980e9decf85bde + last_write_checksum: sha1:f75548bc7c94e834b8ec319bb98784f4abffc6d5 + pristine_git_object: 2dcc8bc0df391567537a05ef4f50abf24a365483 docs/models/previewupdatereset.md: id: 0575a09e5ac1 - last_write_checksum: sha1:ea66a4501813dab3a967f496f1956587ee7e042a - pristine_git_object: c77a0bf238d325dd862cfcade5d00c2478e9fd7f + last_write_checksum: sha1:20aca504ecf7ce4d56eab0ebf69af981c7f2903b + pristine_git_object: c85d5a3300fdaa77bb45b4d92321c92ddb1896f6 docs/models/previewupdateresetinterval.md: id: f23e968cc58e - last_write_checksum: sha1:9c6e22cdee88ec6dbfbe03fd019757636304bf3d - pristine_git_object: 3aaf15ff0898038541e34bab384d2e008cefe7b5 + last_write_checksum: sha1:c4f1239d2233e77448908ff5eb78b17bbdd9ff94 + pristine_git_object: 8290e0f1adeceace60c5189e9d8a2cb0b11471fc docs/models/previewupdateresponse.md: id: 4a657c603c51 last_write_checksum: sha1:235329168519ddb257139112a0d0a0017344c1ac pristine_git_object: 595be6d286ae96fed0d207295c60417719c14181 docs/models/previewupdaterollover.md: id: 269e4cea4344 - last_write_checksum: sha1:ff73c4c2bac34be7019549a3b6fdbf035dbd9abc - pristine_git_object: 2972f7cd1611c1539def1be074adf02d7b209318 + last_write_checksum: sha1:76e74f5e5107f9121fc51b977ebbdc301ee1096e + pristine_git_object: 1487f97cf019f3b6e590b249c669cf6cf807c476 docs/models/previewupdatetier.md: id: bf6c0c1ebd66 last_write_checksum: sha1:60c8e93724c44400c7624b387c71f4e9e7eaf902 @@ -1135,10 +1483,6 @@ trackedFiles: id: c8706fb2f15e last_write_checksum: sha1:ee0c86ede67f157bc7d60c0dbe8c11567ee98418 pristine_git_object: 95413264a179ecbac833d963498c1feeb4fb2d10 - docs/models/pricedisplay.md: - id: 3434a0ab11db - last_write_checksum: sha1:589317957949aa94497a1aa6a3e3a557f6337973 - pristine_git_object: 5af13ee5d38a23052ae3599b12021bccdedc9ef8 docs/models/product.md: id: c91436bbe13a last_write_checksum: sha1:278c24e7ce644e049412cff1e26cf98fd22b99b6 @@ -1147,10 +1491,6 @@ trackedFiles: id: ab3587084a21 last_write_checksum: sha1:34b69aa0f068905c5c668fef314d6d278865864e pristine_git_object: 3c82690287597c8ab32ec97a8f6f4150aa78f58a - docs/models/proration.md: - id: ac1d089c0fd1 - last_write_checksum: sha1:8e99d5a7e22633074b779591132d0894a750486f - pristine_git_object: aebfc4cbff8307ee1e606db1b538d58f3312c6ba docs/models/purchase.md: id: f872769b6939 last_write_checksum: sha1:b250603c69b08d953b6f2dde179eec8606d27ef9 @@ -1189,12 +1529,24 @@ trackedFiles: pristine_git_object: 556f622fc78575df4efda34f58c9dc8c7da7318b docs/models/scenario.md: id: e3aad8ab5efa - last_write_checksum: sha1:10d2ef18c8acb243a1519493cea42c958126ec92 - pristine_git_object: c89b05ac929a4da23f05763cd36890c22cda2a02 + last_write_checksum: sha1:132dfc4d6a03ff1073be4390633a64afd909c700 + pristine_git_object: 58c924cbae30e7c3a227a04ab9655c97381be99a docs/models/security.md: id: 452e4d4eb67a last_write_checksum: sha1:64787360e0bddbe1d2d2ede91992fa1a27c15a0e pristine_git_object: a5c3adda6c609878c33600537edbd46c90aa1711 + docs/models/setuppaymentglobals.md: + id: 3c1e725a7564 + last_write_checksum: sha1:822c35950651414cffcfbf989054afc107a8de68 + pristine_git_object: e46150aa6597ad09d02461b1438d42eb20ad44cf + docs/models/setuppaymentparams.md: + id: d71f82dde273 + last_write_checksum: sha1:9a980c84a736089264b8c32fb6bdacb3bf0d1010 + pristine_git_object: a2ab141be3a5d1231ab7c0c567eaa04121c5fa4d + docs/models/setuppaymentresponse.md: + id: a0fe36809906 + last_write_checksum: sha1:7a862495b69fa946bc361455439d24d9fdf3a3c0 + pristine_git_object: 06ac684aaa678cd7abfc4aef70f435d1637fecb6 docs/models/status.md: id: 959cd204aadf last_write_checksum: sha1:a475fcd3bc7f144921949a0d9bbb85529d986841 @@ -1311,6 +1663,170 @@ trackedFiles: id: 0ba0a862dcca last_write_checksum: sha1:cce928a20c3fccdaa2d05f1cd9f4d24d01ef6eb1 pristine_git_object: 7ded05a41034ccfa5be6f65118f23d14503dfcdd + docs/models/updateplanbillingmethodrequest.md: + id: 9ece57bad5bb + last_write_checksum: sha1:cfa1e131cdd0a2fb39157b1f4dfab588dbff01b4 + pristine_git_object: a59277cc10586f7b3937a81ad5d853f5c5e5fa99 + docs/models/updateplanbillingmethodresponse.md: + id: 1f6a0cc6dd9d + last_write_checksum: sha1:c43d4eafa56f7696011abfbe2a653e6da459d66f + pristine_git_object: 336643d69469be6447c4b155b0b2582cf2bfc4b0 + docs/models/updateplancreditschema.md: + id: 00c090e1bf26 + last_write_checksum: sha1:38829677cb91237900845a612c71c5341cecb59a + pristine_git_object: b435b3f93c28f38a529ccf32beaf93c7941158c6 + docs/models/updateplandurationtyperequest.md: + id: a2b05beb83e5 + last_write_checksum: sha1:749717a358e65ef0d99188b259bb443fb3baeb5e + pristine_git_object: a5e74c2711474666844909fd7723b7054d3d908e + docs/models/updateplandurationtyperesponse.md: + id: f7bb7d7c64e1 + last_write_checksum: sha1:853186bdefa8008db9bbcda97cd1b5c8da7cedd6 + pristine_git_object: a6655d3f8cded4515f58037409612e985ffd3a41 + docs/models/updateplanenv.md: + id: 7b54ca1834fa + last_write_checksum: sha1:aeb7637ae4d1aa4d4d9163a90d5525f575781669 + pristine_git_object: 4d2737b1c882b506c026e01fdd63b66b9dbd16d4 + docs/models/updateplanexpirydurationtyperequest.md: + id: c44c66c550dc + last_write_checksum: sha1:67d347bce270f142bf537e3e10095f385d9c0f62 + pristine_git_object: 4cb0c3b037641bed277eb928ae0241f10c3e17c0 + docs/models/updateplanexpirydurationtyperesponse.md: + id: 3801fddf678d + last_write_checksum: sha1:f7cb607bcb647cb6d995ac8033f9f488aa073554 + pristine_git_object: 0d56ea783952da17b628f6a750aac9a683fae797 + docs/models/updateplanfeature.md: + id: 0e58961a26f1 + last_write_checksum: sha1:940e0421db24f039755d98a9769d68a39dfdb305 + pristine_git_object: feb3bd82db8d34f53879f837c2ed94736f8f06bd + docs/models/updateplanfeaturedisplay.md: + id: 0454f8bceda2 + last_write_checksum: sha1:3e8df149c70312ef3d06931429d42a72f44f9a1a + pristine_git_object: 02d1005d8cb5064ce2d7c8aa24e4a49e2646cc7c + docs/models/updateplanfreetrialrequest.md: + id: 1405ddc77c50 + last_write_checksum: sha1:0599b514ff97db5dd168262ffdf637d50f18a4e9 + pristine_git_object: 11d00bd8a2f597358ce55e682b6f0eed5706bc00 + docs/models/updateplanfreetrialresponse.md: + id: 3d5a6655f34f + last_write_checksum: sha1:ff83bae2d68230871d345dcdb1a8797e22d08b92 + pristine_git_object: f834a76804cebe0e32bd07eab6591f370136c2bc + docs/models/updateplanglobals.md: + id: f643cb83994e + last_write_checksum: sha1:e3d074130e1e89d399c431b48de989308dfdac79 + pristine_git_object: b57a24f33b2a8d5648e59a59cb92199d1382e980 + docs/models/updateplanitemdisplay.md: + id: a000c47b8faa + last_write_checksum: sha1:d4cf8a095188f7f59696cfc7b4624e4a5f5d4866 + pristine_git_object: 21629fa6207463ffa51a8292ea306694bb3702f0 + docs/models/updateplanitempriceintervalrequest.md: + id: 4ba82cce682a + last_write_checksum: sha1:e0c021f6936b3a52d8dc5652fe4e8aaa569d5b46 + pristine_git_object: 01a0ae3b5e94f3e919869282da57d52b4ced9f1d + docs/models/updateplanitempricerequest.md: + id: 567d25ee07e5 + last_write_checksum: sha1:c6ba224b5a53974dda26387d0f59167ec137edb6 + pristine_git_object: a6256f2f827250af705168210c1551ee253746e0 + docs/models/updateplanitempriceresponse.md: + id: ad114972ca0e + last_write_checksum: sha1:5b3d13035deafd36d5e263a3157f4dd4101fe534 + pristine_git_object: e08dbd33959b48587491eceb0455e7ef5c269831 + docs/models/updateplanitemrequest.md: + id: 9945aed55740 + last_write_checksum: sha1:f61c97d048e77e2dcae47b4a3eca6e1ac53bf232 + pristine_git_object: 27d807add3d77809f4435bcbf567376f18ecef4b + docs/models/updateplanitemresponse.md: + id: 04a63c90c077 + last_write_checksum: sha1:93805deb65ea311221115a9d74beae8319068013 + pristine_git_object: 816928fef5f98833e9b24a1164eef8159b137695 + docs/models/updateplanondecrease.md: + id: 02ccbf603191 + last_write_checksum: sha1:2fd6b7131d7b287b55e4933cf56460a282e912dc + pristine_git_object: d21cecf98d8d4914ff936c09a63ab7687292c6fe + docs/models/updateplanonincrease.md: + id: 764d851d7cca + last_write_checksum: sha1:40bf70c3e175e1d46508f9f250c7b4aa0c2222c8 + pristine_git_object: 04577435bf75320ae14c441d963a401faa3cdc85 + docs/models/updateplanparams.md: + id: ca9b432d1066 + last_write_checksum: sha1:9fc147c55f0cf83bd1d5cd45d79ab6ce1d6ddec9 + pristine_git_object: 40a0438a66585278a77659218ac03b4bb618553e + docs/models/updateplanpricedisplay.md: + id: a0739df45768 + last_write_checksum: sha1:596e9404a69cc2f412932fb602dab592e1b9056b + pristine_git_object: acb2e90916dba40e2bf46027f5a9288945633565 + docs/models/updateplanpriceintervalrequest.md: + id: 616fa0a68bae + last_write_checksum: sha1:56b5b2ca99d7033ad6fe94cc4ecc441414e9ab80 + pristine_git_object: 243d5c0620ab4625e02283cce16f978dbe889573 + docs/models/updateplanpriceintervalresponse.md: + id: fd5b2b703739 + last_write_checksum: sha1:52fc0ea4df6fcaaaf341c737ae7d140db12eca4c + pristine_git_object: 74b3b32e7e92194886ba12877681f19587af3ca7 + docs/models/updateplanpriceitemintervalresponse.md: + id: d6754f53396d + last_write_checksum: sha1:11791b341094597d0d24d633fb4a44d97e258072 + pristine_git_object: 97de36201b0ea99623c236027ac84971540b259b + docs/models/updateplanpricerequest.md: + id: 768f8e75b84e + last_write_checksum: sha1:3f059d9eb6febd3f5700c70261cc5b7acdcfb3af + pristine_git_object: 621bc0d5d742e058f0ddfe39dca7c50586111006 + docs/models/updateplanpriceresponse.md: + id: 61ed2a03a5de + last_write_checksum: sha1:8e99830778d69be073b959cf40ee78be83f7178e + pristine_git_object: ff7cecb0082ea35ffe0f3ed45fd156b5b78ed3b8 + docs/models/updateplanproration.md: + id: 6c71cd3f66e2 + last_write_checksum: sha1:157a4ca01eae2f8bc37522b009c8021e456a7b68 + pristine_git_object: 2d494ae9f039b1cc5e0ce0744f92a4f8207c8eb8 + docs/models/updateplanresetintervalrequest.md: + id: 7c76042b1bd9 + last_write_checksum: sha1:2ffe8a420f674dd4812f921af3a4d8f606c0151a + pristine_git_object: da79d525d03183817af5fd1d86797de83a58e670 + docs/models/updateplanresetintervalresponse.md: + id: ce0550104677 + last_write_checksum: sha1:a3e94d39ec09299488530f04d34333aabd42ccae + pristine_git_object: ead7fffc15f6affb3580165d36b3afbd0cd8c601 + docs/models/updateplanresetrequest.md: + id: e5a7572f3d0c + last_write_checksum: sha1:7696cc75c02ddc1747d11d277ae1c39c98f33eed + pristine_git_object: 81466e5ed90e7493ebe0c67410f8ce3d8d5b955d + docs/models/updateplanresetresponse.md: + id: 7e9115b0c55a + last_write_checksum: sha1:b3d948c2588f6cbcd0005387faf1ec85a6a906c2 + pristine_git_object: 2b4c66a3228472b73baa794aa68198ac5ecd0195 + docs/models/updateplanresponse.md: + id: 1e9b63fce660 + last_write_checksum: sha1:41b9b3c0508c4c13e37020ec83854d16454ef54f + pristine_git_object: f6d292aa61719499c5398fdbc126b6ec26135d57 + docs/models/updateplanrolloverrequest.md: + id: 9b30d0aaa790 + last_write_checksum: sha1:8fd54549b63ad2f2035ba69b2495dc76b3a969b9 + pristine_git_object: 7c6c7b7d46473ba7b484d8bac9535686d0dbcdef + docs/models/updateplanrolloverresponse.md: + id: 0a52d5c7913f + last_write_checksum: sha1:c6f5bcad7bce5275d84401625b4cdafeddb69c4c + pristine_git_object: c9c19d637b8d395bf116699d8ea2d732dfa0e707 + docs/models/updateplantierrequest.md: + id: 89f1585fb63e + last_write_checksum: sha1:25c314dd288c205f5c3c485048f0fc1ffb12241f + pristine_git_object: e07dfc6857cc0e48cec7fde1c570a55819654363 + docs/models/updateplantierresponse.md: + id: 51ec5eb77420 + last_write_checksum: sha1:15559f85d049d60be933431a90d79bc351e89fdb + pristine_git_object: 7c03b59f7e3106d19a05f4e6a695129c8d9c9f44 + docs/models/updateplantorequest.md: + id: f113605d7dc2 + last_write_checksum: sha1:1a9d31ceafbd45d2def3c1ec20dc31e81c82cfd2 + pristine_git_object: dcfc0041e28837a7b1d726eaeb980d75baab0523 + docs/models/updateplantoresponse.md: + id: 4eea4a8f9244 + last_write_checksum: sha1:a79660ede0f38de9f1f8442cedb38f73be8a6846 + pristine_git_object: 56445be84abbca351c48cf0745d0c608d44e459d + docs/models/updateplantype.md: + id: edd98356600c + last_write_checksum: sha1:4c871c437a31b5f2547081f5b0f5eaee1f70ca19 + pristine_git_object: b9d2352c615bcb39513c4cb64ff5ea5278814710 docs/models/updatesubscriptionparams.md: id: df1b06618f8b last_write_checksum: sha1:0928a7b478ac515995525f205b559fcd67c4b94e @@ -1333,8 +1849,8 @@ trackedFiles: pristine_git_object: e8485686a84a2f06d13365bb44e01a72015de6f9 docs/sdks/billing/README.md: id: dc915331dd9d - last_write_checksum: sha1:1cde36ee81d42c2a80bd6f15831d74a0fb4405db - pristine_git_object: 0ee824016ad54411965b2205e96873ea2a464b5a + last_write_checksum: sha1:17ee425c16d97446abea4cf52558b4c9d3bea0b7 + pristine_git_object: 4697b200647461b918c0b748f96d0d666b59eaa7 docs/sdks/customers/README.md: id: 9332759cffc2 last_write_checksum: sha1:13ccde8e19cf24ebf4afdac645940c09a642d652 @@ -1353,8 +1869,8 @@ trackedFiles: pristine_git_object: bc0ddec3a6ae1a591a6ee4c572a61731600974bd docs/sdks/plans/README.md: id: 2d8c741fff57 - last_write_checksum: sha1:6fc3e8fbf866ad15f3c3ea27a43c05321ce0c336 - pristine_git_object: 298f2d957925a4892ebb388df3ae2b0d5521648e + last_write_checksum: sha1:6469f928a2815f4a772958d73eb32b8406b51f3d + pristine_git_object: 52a32271ce2b2a789094692f12a674518e070989 docs/sdks/referrals/README.md: id: 50b71f597f20 last_write_checksum: sha1:f85c411ffbff1df16003de60ae49061351081c68 @@ -1369,8 +1885,8 @@ trackedFiles: pristine_git_object: 5650f49e06066f8a1338afdbc0e155f5277152df pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:6c37f703a41fa52d10afd066e7511a5116d63597 - pristine_git_object: e2831b291681aeb0c5fda989d362f478abb34901 + last_write_checksum: sha1:830fd3b1f4f990f8bee5e6cb47d551f1b2121fc3 + pristine_git_object: 7edc2f3dcefaf2aa8e7ef11eb3e3ebefe181924c scripts/publish.sh: id: fe273b08f514 last_write_checksum: sha1:adc9b741c12ad1591ab4870eabe20f0d0a86cd1a @@ -1393,8 +1909,8 @@ trackedFiles: pristine_git_object: 3e604651c1eae73d815b276806e73b2f1334bb79 src/autumn_sdk/_version.py: id: a98babfdf4fc - last_write_checksum: sha1:83a1174d41736f7cd4848b98797cadc19e13574b - pristine_git_object: 19d30374e7352c6dea571aeb7de9d82a85626a5c + last_write_checksum: sha1:599827328cb4ef279014cf22c02c0ee217a5f9d0 + pristine_git_object: 9687a698fad72ee9e39c53c834dc11edcd6d1108 src/autumn_sdk/balances.py: id: 0a15be654dad last_write_checksum: sha1:bcef18a651842ffe96a5a72f608c4c37e2443bf7 @@ -1405,8 +1921,8 @@ trackedFiles: pristine_git_object: b8da96bd89ddafaedb32f4ecac64c27027fcca79 src/autumn_sdk/billing.py: id: e6cffdbf2221 - last_write_checksum: sha1:c9f2a0db3c1f6a53da5b5e7162d44f4db1c74b50 - pristine_git_object: bb52c0bb506b7296224d56e0f0dedbd48582b636 + last_write_checksum: sha1:087987b19375c91b012edcee22129f1b96858080 + pristine_git_object: c2465a6c16b5f5d9bd56a19e7313903d2192f2b6 src/autumn_sdk/customers.py: id: 5c5a0a07a433 last_write_checksum: sha1:d34a9c1215e7685f15ef88c049e707d9c47163e7 @@ -1449,8 +1965,8 @@ trackedFiles: pristine_git_object: 89560b566073785535643e694c112bedbd3db13d src/autumn_sdk/models/__init__.py: id: bcf3802243ff - last_write_checksum: sha1:e968841ec91c61f56208cba0b591fede15bfd857 - pristine_git_object: ea15933e77069ceaade77c6c5d3d21f02a5d3312 + last_write_checksum: sha1:4842c31bffce323c6b399a744b531eaae6286aa0 + pristine_git_object: ab9795d4cd6d4ff5f9c723655a24377363665efc src/autumn_sdk/models/aggregateeventsop.py: id: 01321099f2a5 last_write_checksum: sha1:2adb01a9d319cd46833411082c88c0a49910546d @@ -1461,16 +1977,16 @@ trackedFiles: pristine_git_object: 30665ef90067900c833e72a3c066687c03fa2b3a src/autumn_sdk/models/billingattachop.py: id: a3c4907bef48 - last_write_checksum: sha1:4df8e0be4793f1c9d5a1799271646e5333495630 - pristine_git_object: c1b7c3ceea3c59706dcc9d28b7ef8fe5d5d0f92b + last_write_checksum: sha1:9adfbde080cb531280d43a3c9db2b0b0012ceee1 + pristine_git_object: 59ce78a23331d0a1196513c2dd7199df4ffeed01 src/autumn_sdk/models/billingupdateop.py: id: a2f17c75cfd3 - last_write_checksum: sha1:843c71d8d48b0b820f27d24a462aaca25f5f79e6 - pristine_git_object: c96d4631e7b2fc37ec87b763234743c979f4e058 + last_write_checksum: sha1:5323cd5e48231487c86d7b98c347c5ead067b704 + pristine_git_object: f255a231bc5a9cb71d4891ef19af70712755d30e src/autumn_sdk/models/checkop.py: id: 31c2f84723c6 - last_write_checksum: sha1:a796d3c4a65164f9c3dda96bc8449a622e1f67c9 - pristine_git_object: 3dc1534e5a041aed3cb5ae63ba4df5a404be3757 + last_write_checksum: sha1:739049de845629f70c56a5cd5c202dabfdc6b59f + pristine_git_object: 21a4f89c09c418387e52d10887b81556c5106bfd src/autumn_sdk/models/createbalanceop.py: id: 27daf4da75bf last_write_checksum: sha1:34b47fdbbbd50d3b08e6a1a0a060afc78f1262df @@ -1483,6 +1999,10 @@ trackedFiles: id: 68487033fbe5 last_write_checksum: sha1:80abeb27d4ce175e1a846b3bf3d770fda376e7c2 pristine_git_object: 562905c31e832ef5ebba913bf3a859bcb14c6f92 + src/autumn_sdk/models/createplanop.py: + id: 077e6c7db2ad + last_write_checksum: sha1:ef93520e46094aeaf284d9c4565058804f0ddbec + pristine_git_object: 78e018148f7cf7dea95a6a4011b9733199f86b7f src/autumn_sdk/models/createreferralcodeop.py: id: 2f5f7b136c39 last_write_checksum: sha1:d0038bf28487af519cea4610bd34ba21cd8f99c1 @@ -1511,6 +2031,10 @@ trackedFiles: id: 2cde77bc8684 last_write_checksum: sha1:7e558420116788fbada56887640bb0349c12bae2 pristine_git_object: 4aa293ece7a8533fdae3778760bb4f21caa9cf1d + src/autumn_sdk/models/deleteplanop.py: + id: 4dd8168b93d3 + last_write_checksum: sha1:585309f932b912462149332ed81f959856f40e93 + pristine_git_object: e56bbf69c72fd11e9cee0ef824d4e73beeadf5db src/autumn_sdk/models/getentityop.py: id: 6a624594b41f last_write_checksum: sha1:159356356526db95f65805976e39fb891f709bd1 @@ -1523,6 +2047,10 @@ trackedFiles: id: acfac0d7be14 last_write_checksum: sha1:033c7bd619e40b85d9f5823c78021bec66206c6e pristine_git_object: 6f59baae0a062bf5955a4501af2381b3ffad5857 + src/autumn_sdk/models/getplanop.py: + id: 590fb77ac88d + last_write_checksum: sha1:15cbe342d3b3b81ed365e82923241809d7e2a572 + pristine_git_object: 9f3389434c7fabbd394ba776ae74204af0a2608c src/autumn_sdk/models/internal/__init__.py: id: 2906fe7f2cde last_write_checksum: sha1:5beaf7e5a713d3eead465c6edcfdeb7f8076175c @@ -1545,24 +2073,24 @@ trackedFiles: pristine_git_object: a95ba349b4dd8c3f72cdda328b0b406b205eff3d src/autumn_sdk/models/listplansop.py: id: fdf892c403f4 - last_write_checksum: sha1:d478ba4edd01b7a9b6871eb072e8df7718263202 - pristine_git_object: 1a0a5ec5f0cefac2fa8264613b9bf32bdfe21e88 + last_write_checksum: sha1:dbbc9678cd8718df4751552807935cccbf2a0904 + pristine_git_object: 43c39a4afdbfe07bcea035aea51a518e053b8e8b src/autumn_sdk/models/opencustomerportalop.py: id: 004cc9a6466f last_write_checksum: sha1:0252fea07d0b1fae1817d49a5c187490c49b47ac pristine_git_object: b27e54cf4c5b3923a03e1d3338c548d5ce8a0f95 src/autumn_sdk/models/plan.py: id: f85c4e07540d - last_write_checksum: sha1:22e2a922bb7932e1981bcda22043c0e750b12a96 - pristine_git_object: 19eb173553ba62bf0262e8f7922f6ded23e6252a + last_write_checksum: sha1:39c42975096e0f28f6945b782682579abf30f950 + pristine_git_object: 76e8c1505e9102308c14c632d8b5193ee79ea500 src/autumn_sdk/models/previewattachop.py: id: 2b361be4bfa8 - last_write_checksum: sha1:da36e77a7dc9dec683800420cc51dad4fc61f807 - pristine_git_object: 56792db8f47793b1d0c1a0e65de5be431ae1e381 + last_write_checksum: sha1:2f00c5a157a31f3a3a3c1c9ef70f4085dc763357 + pristine_git_object: 6826b9228536c10719e94aa729df71e29cd6a7cc src/autumn_sdk/models/previewupdateop.py: id: 081d5f08508d - last_write_checksum: sha1:a7146365befbb6fd12b412e70cffa0356a5e0e63 - pristine_git_object: a313a711b72ed15f33177596211fde79370575bd + last_write_checksum: sha1:ce8b9f121251ccfa38bf5f0cf01a27c5ede5223c + pristine_git_object: 486da27a3b605ed39b12fbc5f838707d76035b68 src/autumn_sdk/models/redeemreferralcodeop.py: id: 0abd7bfae718 last_write_checksum: sha1:9096caecd5e39572e409302b99c6c89be0ae9add @@ -1571,6 +2099,10 @@ trackedFiles: id: 27d01b755fbe last_write_checksum: sha1:e5ac2e52ed9c2db46d4989c4744c230dd12bdf01 pristine_git_object: aa686dd6f85ae1e27450392fcfe02527adfe8e61 + src/autumn_sdk/models/setuppaymentop.py: + id: 603339ee67e3 + last_write_checksum: sha1:816cc9c4c952c1a0958d9b661a2defd94c30718b + pristine_git_object: 9ae3881ae67544fed92f8867a2b0afe449926b30 src/autumn_sdk/models/trackop.py: id: 2a744315e781 last_write_checksum: sha1:6b678a5fe2b9b2cd1a2d690edcec1f53528338ec @@ -1587,10 +2119,14 @@ trackedFiles: id: 2fdfed4aa2f2 last_write_checksum: sha1:cc6002bfec963767af99b454901685203e557e19 pristine_git_object: 15986b41d5fc3e0c733e4eea64805aea50933918 + src/autumn_sdk/models/updateplanop.py: + id: 753ddf45ca40 + last_write_checksum: sha1:edc848536576fe68a711e535b2338fe6f82148a3 + pristine_git_object: 1a4c78beea60c43170e5ff6e03730c13ae98bfab src/autumn_sdk/plans.py: id: cf1ebabb687c - last_write_checksum: sha1:73164e47a6348eff5882dee9e65092e6687a18e8 - pristine_git_object: 6c6291f7c856680d05adc3463029c0b5bebf0ef0 + last_write_checksum: sha1:75774145fda00a6387e73c8c12903345f1105cb8 + pristine_git_object: 95f31b5ba96e7c2c42718d7ffca09b692ecc4f16 src/autumn_sdk/py.typed: id: 9b75cee1c007 last_write_checksum: sha1:8efc425ffe830805ffcc0f3055871bdcdc542c60 @@ -1847,9 +2383,11 @@ examples: parameters: header: x-api-version: "2.1" + requestBody: + application/json: {} responses: "200": - application/json: {"list": []} + application/json: {"list": [{"id": "pro", "name": "Pro Plan", "description": null, "group": null, "version": 1, "add_on": true, "auto_enable": false, "price": {"amount": 10, "interval": "month", "display": {"primary_text": ""}}, "items": [{"feature_id": "", "included": 100, "unlimited": false, "reset": {"interval": "month"}, "price": {"amount": 0.5, "interval": "month", "billing_units": 4969.56, "billing_method": "usage_based", "max_purchase": 5540.05}, "display": {"primary_text": ""}}, {"feature_id": "", "included": 0, "unlimited": false, "reset": null, "price": {"amount": 10, "interval": "month", "billing_units": 7445.4, "billing_method": "usage_based", "max_purchase": 66.27}, "display": {"primary_text": ""}}], "created_at": 3936.86, "env": "sandbox", "archived": false, "base_variant_id": ""}]} previewAttach: speakeasy-default-preview-attach: parameters: @@ -1886,10 +2424,10 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"customer_id": ""} + application/json: {"customer_id": "cus_123", "success_url": "https://example.com/account/billing"} responses: "200": - application/json: {"customer_id": "", "url": "https://courteous-emergent.name"} + application/json: {"customer_id": "cus_123", "url": "https://courteous-emergent.name"} previewBillingUpdate: speakeasy-default-preview-billing-update: parameters: @@ -2108,4 +2646,44 @@ examples: responses: "200": application/json: {"success": true} + createPlan: + speakeasy-default-create-plan: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"plan_id": "free_plan", "group": "", "name": "Free", "add_on": false, "auto_enable": true, "items": [{"feature_id": "messages", "included": 100, "reset": {"interval": "month"}}]} + responses: + "200": + application/json: {"id": "pro", "name": "Pro Plan", "description": null, "group": null, "version": 1, "add_on": false, "auto_enable": false, "price": {"amount": 10, "interval": "month", "display": {"primary_text": ""}}, "items": [{"feature_id": "", "included": 100, "unlimited": false, "reset": {"interval": "month"}, "price": {"amount": 0.5, "interval": "month", "billing_units": 4655.71, "billing_method": "prepaid", "max_purchase": 8104.69}, "display": {"primary_text": ""}}, {"feature_id": "", "included": 0, "unlimited": false, "reset": null, "price": {"amount": 10, "interval": "month", "billing_units": 5104.62, "billing_method": "prepaid", "max_purchase": null}, "display": {"primary_text": ""}}], "created_at": 1016.83, "env": "sandbox", "archived": false, "base_variant_id": ""} + getPlan: + speakeasy-default-get-plan: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"plan_id": "pro_plan"} + responses: + "200": + application/json: {"id": "pro", "name": "Pro Plan", "description": null, "group": null, "version": 1, "add_on": true, "auto_enable": false, "price": {"amount": 10, "interval": "month", "display": {"primary_text": ""}}, "items": [{"feature_id": "", "included": 100, "unlimited": false, "reset": {"interval": "month"}, "price": {"amount": 0.5, "interval": "month", "billing_units": 6216.63, "billing_method": "usage_based", "max_purchase": 9351.86}, "display": {"primary_text": ""}}, {"feature_id": "", "included": 0, "unlimited": false, "reset": null, "price": {"amount": 10, "interval": "month", "billing_units": 5235.67, "billing_method": "usage_based", "max_purchase": 9347.74}, "display": {"primary_text": ""}}], "created_at": 1101.73, "env": "sandbox", "archived": false, "base_variant_id": ""} + updatePlan: + speakeasy-default-update-plan: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"plan_id": "pro_plan", "group": "", "name": "Pro Plan (Updated)", "price": {"amount": 15, "interval": "month"}, "archived": false} + responses: + "200": + application/json: {"id": "pro", "name": "Pro Plan", "description": null, "group": null, "version": 1, "add_on": true, "auto_enable": true, "price": {"amount": 10, "interval": "month", "display": {"primary_text": ""}}, "items": [{"feature_id": "", "included": 100, "unlimited": false, "reset": {"interval": "month"}, "price": {"amount": 0.5, "interval": "month", "billing_units": 4113.21, "billing_method": "usage_based", "max_purchase": 5381.55}, "display": {"primary_text": ""}}, {"feature_id": "", "included": 0, "unlimited": false, "reset": null, "price": {"amount": 10, "interval": "month", "billing_units": 3844.43, "billing_method": "prepaid", "max_purchase": 1075.8}, "display": {"primary_text": ""}}], "created_at": 5898.47, "env": "sandbox", "archived": false, "base_variant_id": null} + deletePlan: + speakeasy-default-delete-plan: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"plan_id": "unused_plan", "all_versions": false} + responses: + "200": + application/json: {"success": false} examplesVersion: 1.0.2 diff --git a/others/python-sdk/.speakeasy/gen.yaml b/others/python-sdk/.speakeasy/gen.yaml index 0ae59ee29..588772faa 100644 --- a/others/python-sdk/.speakeasy/gen.yaml +++ b/others/python-sdk/.speakeasy/gen.yaml @@ -30,7 +30,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false python: - version: 0.4.8 + version: 0.4.15 additionalDependencies: dev: {} main: {} diff --git a/others/python-sdk/README.md b/others/python-sdk/README.md index 8ad02dd33..680abc477 100644 --- a/others/python-sdk/README.md +++ b/others/python-sdk/README.md @@ -227,6 +227,7 @@ Use this endpoint to update prepaid quantities, cancel a subscription (immediate Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. * [open_customer_portal](docs/sdks/billing/README.md#open_customer_portal) - Create a billing portal session for a customer to manage their subscription. +* [setup_payment](docs/sdks/billing/README.md#setup_payment) - Create a payment setup session for a customer to add or update their payment method. ### [Customers](docs/sdks/customers/README.md) @@ -274,7 +275,11 @@ Use this to permanently remove a feature. Note: features that are used in produc ### [Plans](docs/sdks/plans/README.md) +* [create](docs/sdks/plans/README.md#create) - Create a plan +* [get](docs/sdks/plans/README.md#get) - Get a plan * [list](docs/sdks/plans/README.md#list) - List all plans +* [update](docs/sdks/plans/README.md#update) - Update a plan +* [delete](docs/sdks/plans/README.md#delete) - Delete a plan ### [Referrals](docs/sdks/referrals/README.md) diff --git a/others/python-sdk/docs/models/billingattachbillingmethod.md b/others/python-sdk/docs/models/billingattachbillingmethod.md index 1f193df28..01d5f7eda 100644 --- a/others/python-sdk/docs/models/billingattachbillingmethod.md +++ b/others/python-sdk/docs/models/billingattachbillingmethod.md @@ -1,5 +1,7 @@ # BillingAttachBillingMethod +'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + ## Values diff --git a/others/python-sdk/docs/models/billingattachdurationtype.md b/others/python-sdk/docs/models/billingattachdurationtype.md index fae86af7c..41bb3014b 100644 --- a/others/python-sdk/docs/models/billingattachdurationtype.md +++ b/others/python-sdk/docs/models/billingattachdurationtype.md @@ -1,5 +1,7 @@ # BillingAttachDurationType +Unit of time for the trial ('day', 'month', 'year'). + ## Values diff --git a/others/python-sdk/docs/models/billingattachexpirydurationtype.md b/others/python-sdk/docs/models/billingattachexpirydurationtype.md index 05f095171..101777f76 100644 --- a/others/python-sdk/docs/models/billingattachexpirydurationtype.md +++ b/others/python-sdk/docs/models/billingattachexpirydurationtype.md @@ -1,5 +1,7 @@ # BillingAttachExpiryDurationType +When rolled over units expire. + ## Values diff --git a/others/python-sdk/docs/models/billingattachfreetrial.md b/others/python-sdk/docs/models/billingattachfreetrial.md index c3641698d..bae7488ab 100644 --- a/others/python-sdk/docs/models/billingattachfreetrial.md +++ b/others/python-sdk/docs/models/billingattachfreetrial.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `duration_length` | *float* | :heavy_check_mark: | N/A | -| `duration_type` | [Optional[models.BillingAttachDurationType]](../models/billingattachdurationtype.md) | :heavy_minus_sign: | N/A | -| `card_required` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `duration_length` | *float* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `duration_type` | [Optional[models.BillingAttachDurationType]](../models/billingattachdurationtype.md) | :heavy_minus_sign: | Unit of time for the trial ('day', 'month', 'year'). | +| `card_required` | *Optional[bool]* | :heavy_minus_sign: | If true, payment method required to start trial. Customer is charged after trial ends. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingattachitem.md b/others/python-sdk/docs/models/billingattachitem.md index 16049a84e..a1d327d3a 100644 --- a/others/python-sdk/docs/models/billingattachitem.md +++ b/others/python-sdk/docs/models/billingattachitem.md @@ -3,12 +3,12 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `included` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `reset` | [Optional[models.BillingAttachReset]](../models/billingattachreset.md) | :heavy_minus_sign: | N/A | -| `price` | [Optional[models.BillingAttachItemPrice]](../models/billingattachitemprice.md) | :heavy_minus_sign: | N/A | -| `proration` | [Optional[models.BillingAttachProration]](../models/billingattachproration.md) | :heavy_minus_sign: | N/A | -| `rollover` | [Optional[models.BillingAttachRollover]](../models/billingattachrollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature to configure. | +| `included` | *Optional[float]* | :heavy_minus_sign: | Number of free units included. Balance resets to this each interval for consumable features. | +| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | If true, customer has unlimited access to this feature. | +| `reset` | [Optional[models.BillingAttachReset]](../models/billingattachreset.md) | :heavy_minus_sign: | Reset configuration for consumable features. Omit for non-consumable features like seats. | +| `price` | [Optional[models.BillingAttachItemPrice]](../models/billingattachitemprice.md) | :heavy_minus_sign: | Pricing for usage beyond included units. Omit for free features. | +| `proration` | [Optional[models.BillingAttachProration]](../models/billingattachproration.md) | :heavy_minus_sign: | Proration settings for prepaid features. Controls mid-cycle quantity change billing. | +| `rollover` | [Optional[models.BillingAttachRollover]](../models/billingattachrollover.md) | :heavy_minus_sign: | Rollover config for unused units. If set, unused included units carry over. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingattachitemprice.md b/others/python-sdk/docs/models/billingattachitemprice.md index 9c1568802..25f38face 100644 --- a/others/python-sdk/docs/models/billingattachitemprice.md +++ b/others/python-sdk/docs/models/billingattachitemprice.md @@ -1,14 +1,16 @@ # BillingAttachItemPrice +Pricing for usage beyond included units. Omit for free features. + ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.BillingAttachTier](../models/billingattachtier.md)] | :heavy_minus_sign: | N/A | -| `interval` | [models.BillingAttachItemPriceInterval](../models/billingattachitempriceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `billing_units` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `billing_method` | [models.BillingAttachBillingMethod](../models/billingattachbillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `amount` | *Optional[float]* | :heavy_minus_sign: | Price per billing_units after included usage. Either 'amount' or 'tiers' is required. | +| `tiers` | List[[models.BillingAttachTier](../models/billingattachtier.md)] | :heavy_minus_sign: | Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. | +| `interval` | [models.BillingAttachItemPriceInterval](../models/billingattachitempriceinterval.md) | :heavy_check_mark: | Billing interval. For consumable features, should match reset.interval. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billing_units` | *Optional[float]* | :heavy_minus_sign: | Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). | +| `billing_method` | [models.BillingAttachBillingMethod](../models/billingattachbillingmethod.md) | :heavy_check_mark: | 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. | +| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingattachitempriceinterval.md b/others/python-sdk/docs/models/billingattachitempriceinterval.md index d89b9e874..4a2673a0e 100644 --- a/others/python-sdk/docs/models/billingattachitempriceinterval.md +++ b/others/python-sdk/docs/models/billingattachitempriceinterval.md @@ -1,5 +1,7 @@ # BillingAttachItemPriceInterval +Billing interval. For consumable features, should match reset.interval. + ## Values diff --git a/others/python-sdk/docs/models/billingattachondecrease.md b/others/python-sdk/docs/models/billingattachondecrease.md index 63ed5ada1..4c0da568f 100644 --- a/others/python-sdk/docs/models/billingattachondecrease.md +++ b/others/python-sdk/docs/models/billingattachondecrease.md @@ -1,5 +1,7 @@ # BillingAttachOnDecrease +Credit behavior when quantity decreases mid-cycle. + ## Values diff --git a/others/python-sdk/docs/models/billingattachonincrease.md b/others/python-sdk/docs/models/billingattachonincrease.md index 388a9c513..c62c020f7 100644 --- a/others/python-sdk/docs/models/billingattachonincrease.md +++ b/others/python-sdk/docs/models/billingattachonincrease.md @@ -1,5 +1,7 @@ # BillingAttachOnIncrease +Billing behavior when quantity increases mid-cycle. + ## Values diff --git a/others/python-sdk/docs/models/billingattachprice.md b/others/python-sdk/docs/models/billingattachprice.md index cdd55bdfd..2a447950d 100644 --- a/others/python-sdk/docs/models/billingattachprice.md +++ b/others/python-sdk/docs/models/billingattachprice.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `amount` | *float* | :heavy_check_mark: | N/A | -| `interval` | [models.BillingAttachPriceInterval](../models/billingattachpriceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `amount` | *float* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.BillingAttachPriceInterval](../models/billingattachpriceinterval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingattachpriceinterval.md b/others/python-sdk/docs/models/billingattachpriceinterval.md index 0051c7f5d..a7345fc65 100644 --- a/others/python-sdk/docs/models/billingattachpriceinterval.md +++ b/others/python-sdk/docs/models/billingattachpriceinterval.md @@ -1,5 +1,7 @@ # BillingAttachPriceInterval +Billing interval (e.g. 'month', 'year'). + ## Values diff --git a/others/python-sdk/docs/models/billingattachproration.md b/others/python-sdk/docs/models/billingattachproration.md index 8199d7165..9ac101fd7 100644 --- a/others/python-sdk/docs/models/billingattachproration.md +++ b/others/python-sdk/docs/models/billingattachproration.md @@ -1,9 +1,11 @@ # BillingAttachProration +Proration settings for prepaid features. Controls mid-cycle quantity change billing. + ## Fields | Field | Type | Required | Description | | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `on_increase` | [models.BillingAttachOnIncrease](../models/billingattachonincrease.md) | :heavy_check_mark: | N/A | -| `on_decrease` | [models.BillingAttachOnDecrease](../models/billingattachondecrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| `on_increase` | [models.BillingAttachOnIncrease](../models/billingattachonincrease.md) | :heavy_check_mark: | Billing behavior when quantity increases mid-cycle. | +| `on_decrease` | [models.BillingAttachOnDecrease](../models/billingattachondecrease.md) | :heavy_check_mark: | Credit behavior when quantity decreases mid-cycle. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingattachreset.md b/others/python-sdk/docs/models/billingattachreset.md index 27311c469..d127502e3 100644 --- a/others/python-sdk/docs/models/billingattachreset.md +++ b/others/python-sdk/docs/models/billingattachreset.md @@ -1,9 +1,11 @@ # BillingAttachReset +Reset configuration for consumable features. Omit for non-consumable features like seats. + ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `interval` | [models.BillingAttachResetInterval](../models/billingattachresetinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `interval` | [models.BillingAttachResetInterval](../models/billingattachresetinterval.md) | :heavy_check_mark: | Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingattachresetinterval.md b/others/python-sdk/docs/models/billingattachresetinterval.md index fd1fcac8c..9591192f6 100644 --- a/others/python-sdk/docs/models/billingattachresetinterval.md +++ b/others/python-sdk/docs/models/billingattachresetinterval.md @@ -1,5 +1,7 @@ # BillingAttachResetInterval +Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + ## Values diff --git a/others/python-sdk/docs/models/billingattachrollover.md b/others/python-sdk/docs/models/billingattachrollover.md index 0311da1a2..5eb116656 100644 --- a/others/python-sdk/docs/models/billingattachrollover.md +++ b/others/python-sdk/docs/models/billingattachrollover.md @@ -1,10 +1,12 @@ # BillingAttachRollover +Rollover config for unused units. If set, unused included units carry over. + ## Fields | Field | Type | Required | Description | | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `max` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `expiry_duration_type` | [models.BillingAttachExpiryDurationType](../models/billingattachexpirydurationtype.md) | :heavy_check_mark: | N/A | -| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `max` | *Optional[float]* | :heavy_minus_sign: | Max rollover units. Omit for unlimited rollover. | +| `expiry_duration_type` | [models.BillingAttachExpiryDurationType](../models/billingattachexpirydurationtype.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingupdatebillingmethod.md b/others/python-sdk/docs/models/billingupdatebillingmethod.md index e29001f5b..f3d2efee7 100644 --- a/others/python-sdk/docs/models/billingupdatebillingmethod.md +++ b/others/python-sdk/docs/models/billingupdatebillingmethod.md @@ -1,5 +1,7 @@ # BillingUpdateBillingMethod +'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + ## Values diff --git a/others/python-sdk/docs/models/billingupdatedurationtype.md b/others/python-sdk/docs/models/billingupdatedurationtype.md index 7c827b0ad..29c75dda0 100644 --- a/others/python-sdk/docs/models/billingupdatedurationtype.md +++ b/others/python-sdk/docs/models/billingupdatedurationtype.md @@ -1,5 +1,7 @@ # BillingUpdateDurationType +Unit of time for the trial ('day', 'month', 'year'). + ## Values diff --git a/others/python-sdk/docs/models/billingupdateexpirydurationtype.md b/others/python-sdk/docs/models/billingupdateexpirydurationtype.md index 8519f37ac..cf21b1895 100644 --- a/others/python-sdk/docs/models/billingupdateexpirydurationtype.md +++ b/others/python-sdk/docs/models/billingupdateexpirydurationtype.md @@ -1,5 +1,7 @@ # BillingUpdateExpiryDurationType +When rolled over units expire. + ## Values diff --git a/others/python-sdk/docs/models/billingupdatefreetrial.md b/others/python-sdk/docs/models/billingupdatefreetrial.md index 352a83e61..e9aabf27c 100644 --- a/others/python-sdk/docs/models/billingupdatefreetrial.md +++ b/others/python-sdk/docs/models/billingupdatefreetrial.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `duration_length` | *float* | :heavy_check_mark: | N/A | -| `duration_type` | [Optional[models.BillingUpdateDurationType]](../models/billingupdatedurationtype.md) | :heavy_minus_sign: | N/A | -| `card_required` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `duration_length` | *float* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `duration_type` | [Optional[models.BillingUpdateDurationType]](../models/billingupdatedurationtype.md) | :heavy_minus_sign: | Unit of time for the trial ('day', 'month', 'year'). | +| `card_required` | *Optional[bool]* | :heavy_minus_sign: | If true, payment method required to start trial. Customer is charged after trial ends. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingupdateitem.md b/others/python-sdk/docs/models/billingupdateitem.md index ac6389184..a6caacfed 100644 --- a/others/python-sdk/docs/models/billingupdateitem.md +++ b/others/python-sdk/docs/models/billingupdateitem.md @@ -3,12 +3,12 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `included` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `reset` | [Optional[models.BillingUpdateReset]](../models/billingupdatereset.md) | :heavy_minus_sign: | N/A | -| `price` | [Optional[models.BillingUpdateItemPrice]](../models/billingupdateitemprice.md) | :heavy_minus_sign: | N/A | -| `proration` | [Optional[models.BillingUpdateProration]](../models/billingupdateproration.md) | :heavy_minus_sign: | N/A | -| `rollover` | [Optional[models.BillingUpdateRollover]](../models/billingupdaterollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature to configure. | +| `included` | *Optional[float]* | :heavy_minus_sign: | Number of free units included. Balance resets to this each interval for consumable features. | +| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | If true, customer has unlimited access to this feature. | +| `reset` | [Optional[models.BillingUpdateReset]](../models/billingupdatereset.md) | :heavy_minus_sign: | Reset configuration for consumable features. Omit for non-consumable features like seats. | +| `price` | [Optional[models.BillingUpdateItemPrice]](../models/billingupdateitemprice.md) | :heavy_minus_sign: | Pricing for usage beyond included units. Omit for free features. | +| `proration` | [Optional[models.BillingUpdateProration]](../models/billingupdateproration.md) | :heavy_minus_sign: | Proration settings for prepaid features. Controls mid-cycle quantity change billing. | +| `rollover` | [Optional[models.BillingUpdateRollover]](../models/billingupdaterollover.md) | :heavy_minus_sign: | Rollover config for unused units. If set, unused included units carry over. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingupdateitemprice.md b/others/python-sdk/docs/models/billingupdateitemprice.md index 4043279d9..91d83bb7c 100644 --- a/others/python-sdk/docs/models/billingupdateitemprice.md +++ b/others/python-sdk/docs/models/billingupdateitemprice.md @@ -1,14 +1,16 @@ # BillingUpdateItemPrice +Pricing for usage beyond included units. Omit for free features. + ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.BillingUpdateTier](../models/billingupdatetier.md)] | :heavy_minus_sign: | N/A | -| `interval` | [models.BillingUpdateItemPriceInterval](../models/billingupdateitempriceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `billing_units` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `billing_method` | [models.BillingUpdateBillingMethod](../models/billingupdatebillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `amount` | *Optional[float]* | :heavy_minus_sign: | Price per billing_units after included usage. Either 'amount' or 'tiers' is required. | +| `tiers` | List[[models.BillingUpdateTier](../models/billingupdatetier.md)] | :heavy_minus_sign: | Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. | +| `interval` | [models.BillingUpdateItemPriceInterval](../models/billingupdateitempriceinterval.md) | :heavy_check_mark: | Billing interval. For consumable features, should match reset.interval. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billing_units` | *Optional[float]* | :heavy_minus_sign: | Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). | +| `billing_method` | [models.BillingUpdateBillingMethod](../models/billingupdatebillingmethod.md) | :heavy_check_mark: | 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. | +| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingupdateitempriceinterval.md b/others/python-sdk/docs/models/billingupdateitempriceinterval.md index 80ca53524..876d91750 100644 --- a/others/python-sdk/docs/models/billingupdateitempriceinterval.md +++ b/others/python-sdk/docs/models/billingupdateitempriceinterval.md @@ -1,5 +1,7 @@ # BillingUpdateItemPriceInterval +Billing interval. For consumable features, should match reset.interval. + ## Values diff --git a/others/python-sdk/docs/models/billingupdateondecrease.md b/others/python-sdk/docs/models/billingupdateondecrease.md index 05466b330..20bd4b901 100644 --- a/others/python-sdk/docs/models/billingupdateondecrease.md +++ b/others/python-sdk/docs/models/billingupdateondecrease.md @@ -1,5 +1,7 @@ # BillingUpdateOnDecrease +Credit behavior when quantity decreases mid-cycle. + ## Values diff --git a/others/python-sdk/docs/models/billingupdateonincrease.md b/others/python-sdk/docs/models/billingupdateonincrease.md index 7a94a9e75..2ae60a2cb 100644 --- a/others/python-sdk/docs/models/billingupdateonincrease.md +++ b/others/python-sdk/docs/models/billingupdateonincrease.md @@ -1,5 +1,7 @@ # BillingUpdateOnIncrease +Billing behavior when quantity increases mid-cycle. + ## Values diff --git a/others/python-sdk/docs/models/billingupdateprice.md b/others/python-sdk/docs/models/billingupdateprice.md index 86873ed3e..cce87584e 100644 --- a/others/python-sdk/docs/models/billingupdateprice.md +++ b/others/python-sdk/docs/models/billingupdateprice.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `amount` | *float* | :heavy_check_mark: | N/A | -| `interval` | [models.BillingUpdatePriceInterval](../models/billingupdatepriceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `amount` | *float* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.BillingUpdatePriceInterval](../models/billingupdatepriceinterval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingupdatepriceinterval.md b/others/python-sdk/docs/models/billingupdatepriceinterval.md index 42d0f0bca..fef99c2a4 100644 --- a/others/python-sdk/docs/models/billingupdatepriceinterval.md +++ b/others/python-sdk/docs/models/billingupdatepriceinterval.md @@ -1,5 +1,7 @@ # BillingUpdatePriceInterval +Billing interval (e.g. 'month', 'year'). + ## Values diff --git a/others/python-sdk/docs/models/billingupdateproration.md b/others/python-sdk/docs/models/billingupdateproration.md index 11dce0352..b08ae1cb7 100644 --- a/others/python-sdk/docs/models/billingupdateproration.md +++ b/others/python-sdk/docs/models/billingupdateproration.md @@ -1,9 +1,11 @@ # BillingUpdateProration +Proration settings for prepaid features. Controls mid-cycle quantity change billing. + ## Fields | Field | Type | Required | Description | | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `on_increase` | [models.BillingUpdateOnIncrease](../models/billingupdateonincrease.md) | :heavy_check_mark: | N/A | -| `on_decrease` | [models.BillingUpdateOnDecrease](../models/billingupdateondecrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| `on_increase` | [models.BillingUpdateOnIncrease](../models/billingupdateonincrease.md) | :heavy_check_mark: | Billing behavior when quantity increases mid-cycle. | +| `on_decrease` | [models.BillingUpdateOnDecrease](../models/billingupdateondecrease.md) | :heavy_check_mark: | Credit behavior when quantity decreases mid-cycle. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingupdatereset.md b/others/python-sdk/docs/models/billingupdatereset.md index d130ed741..39ab16e49 100644 --- a/others/python-sdk/docs/models/billingupdatereset.md +++ b/others/python-sdk/docs/models/billingupdatereset.md @@ -1,9 +1,11 @@ # BillingUpdateReset +Reset configuration for consumable features. Omit for non-consumable features like seats. + ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `interval` | [models.BillingUpdateResetInterval](../models/billingupdateresetinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `interval` | [models.BillingUpdateResetInterval](../models/billingupdateresetinterval.md) | :heavy_check_mark: | Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingupdateresetinterval.md b/others/python-sdk/docs/models/billingupdateresetinterval.md index f44056d44..8fbdcfac4 100644 --- a/others/python-sdk/docs/models/billingupdateresetinterval.md +++ b/others/python-sdk/docs/models/billingupdateresetinterval.md @@ -1,5 +1,7 @@ # BillingUpdateResetInterval +Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + ## Values diff --git a/others/python-sdk/docs/models/billingupdaterollover.md b/others/python-sdk/docs/models/billingupdaterollover.md index 3f1b81922..5db812903 100644 --- a/others/python-sdk/docs/models/billingupdaterollover.md +++ b/others/python-sdk/docs/models/billingupdaterollover.md @@ -1,10 +1,12 @@ # BillingUpdateRollover +Rollover config for unused units. If set, unused included units carry over. + ## Fields | Field | Type | Required | Description | | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `max` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `expiry_duration_type` | [models.BillingUpdateExpiryDurationType](../models/billingupdateexpirydurationtype.md) | :heavy_check_mark: | N/A | -| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `max` | *Optional[float]* | :heavy_minus_sign: | Max rollover units. Omit for unlimited rollover. | +| `expiry_duration_type` | [models.BillingUpdateExpiryDurationType](../models/billingupdateexpirydurationtype.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/checkscenario.md b/others/python-sdk/docs/models/checkscenario.md deleted file mode 100644 index a3439416a..000000000 --- a/others/python-sdk/docs/models/checkscenario.md +++ /dev/null @@ -1,11 +0,0 @@ -# CheckScenario - -The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `USAGE_LIMIT` | usage_limit | -| `FEATURE_FLAG` | feature_flag | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanbillingmethodrequest.md b/others/python-sdk/docs/models/createplanbillingmethodrequest.md new file mode 100644 index 000000000..f29aef01d --- /dev/null +++ b/others/python-sdk/docs/models/createplanbillingmethodrequest.md @@ -0,0 +1,11 @@ +# CreatePlanBillingMethodRequest + +'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `PREPAID` | prepaid | +| `USAGE_BASED` | usage_based | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanbillingmethodresponse.md b/others/python-sdk/docs/models/createplanbillingmethodresponse.md new file mode 100644 index 000000000..39cd257f0 --- /dev/null +++ b/others/python-sdk/docs/models/createplanbillingmethodresponse.md @@ -0,0 +1,11 @@ +# CreatePlanBillingMethodResponse + +'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `PREPAID` | prepaid | +| `USAGE_BASED` | usage_based | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplancreditschema.md b/others/python-sdk/docs/models/createplancreditschema.md new file mode 100644 index 000000000..77081dec4 --- /dev/null +++ b/others/python-sdk/docs/models/createplancreditschema.md @@ -0,0 +1,9 @@ +# CreatePlanCreditSchema + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `metered_feature_id` | *str* | :heavy_check_mark: | The ID of the metered feature (should be a single_use feature). | +| `credit_cost` | *float* | :heavy_check_mark: | The credit cost of the metered feature. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplandurationtyperequest.md b/others/python-sdk/docs/models/createplandurationtyperequest.md new file mode 100644 index 000000000..830130991 --- /dev/null +++ b/others/python-sdk/docs/models/createplandurationtyperequest.md @@ -0,0 +1,12 @@ +# CreatePlanDurationTypeRequest + +Unit of time for the trial ('day', 'month', 'year'). + + +## Values + +| Name | Value | +| ------- | ------- | +| `DAY` | day | +| `MONTH` | month | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplandurationtyperesponse.md b/others/python-sdk/docs/models/createplandurationtyperesponse.md new file mode 100644 index 000000000..19341d579 --- /dev/null +++ b/others/python-sdk/docs/models/createplandurationtyperesponse.md @@ -0,0 +1,12 @@ +# CreatePlanDurationTypeResponse + +Unit of time for the trial duration ('day', 'month', 'year'). + + +## Values + +| Name | Value | +| ------- | ------- | +| `DAY` | day | +| `MONTH` | month | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanenv.md b/others/python-sdk/docs/models/createplanenv.md new file mode 100644 index 000000000..0d52c5ca2 --- /dev/null +++ b/others/python-sdk/docs/models/createplanenv.md @@ -0,0 +1,11 @@ +# CreatePlanEnv + +Environment this plan belongs to ('sandbox' or 'live'). + + +## Values + +| Name | Value | +| --------- | --------- | +| `SANDBOX` | sandbox | +| `LIVE` | live | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanexpirydurationtyperequest.md b/others/python-sdk/docs/models/createplanexpirydurationtyperequest.md new file mode 100644 index 000000000..54bb9e36c --- /dev/null +++ b/others/python-sdk/docs/models/createplanexpirydurationtyperequest.md @@ -0,0 +1,11 @@ +# CreatePlanExpiryDurationTypeRequest + +When rolled over units expire. + + +## Values + +| Name | Value | +| --------- | --------- | +| `MONTH` | month | +| `FOREVER` | forever | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanexpirydurationtyperesponse.md b/others/python-sdk/docs/models/createplanexpirydurationtyperesponse.md new file mode 100644 index 000000000..e752ec9af --- /dev/null +++ b/others/python-sdk/docs/models/createplanexpirydurationtyperesponse.md @@ -0,0 +1,11 @@ +# CreatePlanExpiryDurationTypeResponse + +When rolled over units expire. + + +## Values + +| Name | Value | +| --------- | --------- | +| `MONTH` | month | +| `FOREVER` | forever | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanfeature.md b/others/python-sdk/docs/models/createplanfeature.md new file mode 100644 index 000000000..99f1efa6d --- /dev/null +++ b/others/python-sdk/docs/models/createplanfeature.md @@ -0,0 +1,15 @@ +# CreatePlanFeature + +The full feature object if expanded. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `id` | *str* | :heavy_check_mark: | The ID of the feature, used to refer to it in other API calls like /track or /check. | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the feature. | +| `type` | [models.CreatePlanType](../models/createplantype.md) | :heavy_check_mark: | The type of the feature | +| `display` | [OptionalNullable[models.CreatePlanFeatureDisplay]](../models/createplanfeaturedisplay.md) | :heavy_minus_sign: | Singular and plural display names for the feature. | +| `credit_schema` | List[[models.CreatePlanCreditSchema](../models/createplancreditschema.md)] | :heavy_minus_sign: | Credit cost schema for credit system features. | +| `archived` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether or not the feature is archived. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanfeaturedisplay.md b/others/python-sdk/docs/models/createplanfeaturedisplay.md new file mode 100644 index 000000000..ddc08f080 --- /dev/null +++ b/others/python-sdk/docs/models/createplanfeaturedisplay.md @@ -0,0 +1,9 @@ +# CreatePlanFeatureDisplay + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `singular` | *str* | :heavy_check_mark: | The singular display name for the feature. | +| `plural` | *str* | :heavy_check_mark: | The plural display name for the feature. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanfreetrialrequest.md b/others/python-sdk/docs/models/createplanfreetrialrequest.md new file mode 100644 index 000000000..33596856b --- /dev/null +++ b/others/python-sdk/docs/models/createplanfreetrialrequest.md @@ -0,0 +1,12 @@ +# CreatePlanFreeTrialRequest + +Free trial configuration. Customers can try this plan before being charged. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `duration_length` | *float* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `duration_type` | [Optional[models.CreatePlanDurationTypeRequest]](../models/createplandurationtyperequest.md) | :heavy_minus_sign: | Unit of time for the trial ('day', 'month', 'year'). | +| `card_required` | *Optional[bool]* | :heavy_minus_sign: | If true, payment method required to start trial. Customer is charged after trial ends. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanfreetrialresponse.md b/others/python-sdk/docs/models/createplanfreetrialresponse.md new file mode 100644 index 000000000..c58c3903a --- /dev/null +++ b/others/python-sdk/docs/models/createplanfreetrialresponse.md @@ -0,0 +1,12 @@ +# CreatePlanFreeTrialResponse + +Free trial configuration. If set, new customers can try this plan before being charged. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `duration_length` | *float* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `duration_type` | [models.CreatePlanDurationTypeResponse](../models/createplandurationtyperesponse.md) | :heavy_check_mark: | Unit of time for the trial duration ('day', 'month', 'year'). | +| `card_required` | *bool* | :heavy_check_mark: | Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/pricedisplay.md b/others/python-sdk/docs/models/createplanglobals.md similarity index 55% rename from others/python-sdk/docs/models/pricedisplay.md rename to others/python-sdk/docs/models/createplanglobals.md index 5af13ee5d..81491698e 100644 --- a/others/python-sdk/docs/models/pricedisplay.md +++ b/others/python-sdk/docs/models/createplanglobals.md @@ -1,9 +1,8 @@ -# PriceDisplay +# CreatePlanGlobals ## Fields | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `primary_text` | *str* | :heavy_check_mark: | N/A | -| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanitemdisplay.md b/others/python-sdk/docs/models/createplanitemdisplay.md new file mode 100644 index 000000000..bd384b452 --- /dev/null +++ b/others/python-sdk/docs/models/createplanitemdisplay.md @@ -0,0 +1,11 @@ +# CreatePlanItemDisplay + +Display text for showing this item in pricing pages. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primary_text` | *str* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanitempriceintervalrequest.md b/others/python-sdk/docs/models/createplanitempriceintervalrequest.md new file mode 100644 index 000000000..5ab2ea0a0 --- /dev/null +++ b/others/python-sdk/docs/models/createplanitempriceintervalrequest.md @@ -0,0 +1,15 @@ +# CreatePlanItemPriceIntervalRequest + +Billing interval. For consumable features, should match reset.interval. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanitempricerequest.md b/others/python-sdk/docs/models/createplanitempricerequest.md new file mode 100644 index 000000000..4f4033dae --- /dev/null +++ b/others/python-sdk/docs/models/createplanitempricerequest.md @@ -0,0 +1,16 @@ +# CreatePlanItemPriceRequest + +Pricing for usage beyond included units. Omit for free features. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `amount` | *Optional[float]* | :heavy_minus_sign: | Price per billing_units after included usage. Either 'amount' or 'tiers' is required. | +| `tiers` | List[[models.CreatePlanTierRequest](../models/createplantierrequest.md)] | :heavy_minus_sign: | Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. | +| `interval` | [models.CreatePlanItemPriceIntervalRequest](../models/createplanitempriceintervalrequest.md) | :heavy_check_mark: | Billing interval. For consumable features, should match reset.interval. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billing_units` | *Optional[float]* | :heavy_minus_sign: | Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). | +| `billing_method` | [models.CreatePlanBillingMethodRequest](../models/createplanbillingmethodrequest.md) | :heavy_check_mark: | 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. | +| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanitempriceresponse.md b/others/python-sdk/docs/models/createplanitempriceresponse.md new file mode 100644 index 000000000..246e93d3d --- /dev/null +++ b/others/python-sdk/docs/models/createplanitempriceresponse.md @@ -0,0 +1,14 @@ +# CreatePlanItemPriceResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[float]* | :heavy_minus_sign: | Price per billing_units after included usage is consumed. Mutually exclusive with tiers. | +| `tiers` | List[[models.CreatePlanTierResponse](../models/createplantierresponse.md)] | :heavy_minus_sign: | Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. | +| `interval` | [models.CreatePlanPriceItemIntervalResponse](../models/createplanpriceitemintervalresponse.md) | :heavy_check_mark: | Billing interval for this price. For consumable features, should match reset.interval. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billing_units` | *float* | :heavy_check_mark: | Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). | +| `billing_method` | [models.CreatePlanBillingMethodResponse](../models/createplanbillingmethodresponse.md) | :heavy_check_mark: | 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. | +| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanitemrequest.md b/others/python-sdk/docs/models/createplanitemrequest.md new file mode 100644 index 000000000..b2880ea3c --- /dev/null +++ b/others/python-sdk/docs/models/createplanitemrequest.md @@ -0,0 +1,14 @@ +# CreatePlanItemRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature to configure. | +| `included` | *Optional[float]* | :heavy_minus_sign: | Number of free units included. Balance resets to this each interval for consumable features. | +| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | If true, customer has unlimited access to this feature. | +| `reset` | [Optional[models.CreatePlanResetRequest]](../models/createplanresetrequest.md) | :heavy_minus_sign: | Reset configuration for consumable features. Omit for non-consumable features like seats. | +| `price` | [Optional[models.CreatePlanItemPriceRequest]](../models/createplanitempricerequest.md) | :heavy_minus_sign: | Pricing for usage beyond included units. Omit for free features. | +| `proration` | [Optional[models.CreatePlanProration]](../models/createplanproration.md) | :heavy_minus_sign: | Proration settings for prepaid features. Controls mid-cycle quantity change billing. | +| `rollover` | [Optional[models.CreatePlanRolloverRequest]](../models/createplanrolloverrequest.md) | :heavy_minus_sign: | Rollover config for unused units. If set, unused included units carry over. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanitemresponse.md b/others/python-sdk/docs/models/createplanitemresponse.md new file mode 100644 index 000000000..a6222412f --- /dev/null +++ b/others/python-sdk/docs/models/createplanitemresponse.md @@ -0,0 +1,15 @@ +# CreatePlanItemResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature this item configures. | +| `feature` | [Optional[models.CreatePlanFeature]](../models/createplanfeature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `included` | *float* | :heavy_check_mark: | Number of free units included. For consumable features, balance resets to this number each interval. | +| `unlimited` | *bool* | :heavy_check_mark: | Whether the customer has unlimited access to this feature. | +| `reset` | [Nullable[models.CreatePlanResetResponse]](../models/createplanresetresponse.md) | :heavy_check_mark: | Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. | +| `price` | [Nullable[models.CreatePlanItemPriceResponse]](../models/createplanitempriceresponse.md) | :heavy_check_mark: | Pricing configuration for usage beyond included units. Null if feature is entirely free. | +| `display` | [Optional[models.CreatePlanItemDisplay]](../models/createplanitemdisplay.md) | :heavy_minus_sign: | Display text for showing this item in pricing pages. | +| `rollover` | [Optional[models.CreatePlanRolloverResponse]](../models/createplanrolloverresponse.md) | :heavy_minus_sign: | Rollover configuration for unused units. If set, unused included units roll over to the next period. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/ondecrease.md b/others/python-sdk/docs/models/createplanondecrease.md similarity index 82% rename from others/python-sdk/docs/models/ondecrease.md rename to others/python-sdk/docs/models/createplanondecrease.md index 6303fefe3..f4f2fd1c2 100644 --- a/others/python-sdk/docs/models/ondecrease.md +++ b/others/python-sdk/docs/models/createplanondecrease.md @@ -1,4 +1,6 @@ -# OnDecrease +# CreatePlanOnDecrease + +Credit behavior when quantity decreases mid-cycle. ## Values diff --git a/others/python-sdk/docs/models/onincrease.md b/others/python-sdk/docs/models/createplanonincrease.md similarity index 80% rename from others/python-sdk/docs/models/onincrease.md rename to others/python-sdk/docs/models/createplanonincrease.md index 39c4dc445..32d69248a 100644 --- a/others/python-sdk/docs/models/onincrease.md +++ b/others/python-sdk/docs/models/createplanonincrease.md @@ -1,4 +1,6 @@ -# OnIncrease +# CreatePlanOnIncrease + +Billing behavior when quantity increases mid-cycle. ## Values diff --git a/others/python-sdk/docs/models/createplanparams.md b/others/python-sdk/docs/models/createplanparams.md new file mode 100644 index 000000000..40a517b04 --- /dev/null +++ b/others/python-sdk/docs/models/createplanparams.md @@ -0,0 +1,16 @@ +# CreatePlanParams + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan to create. | +| `group` | *Optional[str]* | :heavy_minus_sign: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `name` | *str* | :heavy_check_mark: | Display name of the plan. | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional description of the plan. | +| `add_on` | *Optional[bool]* | :heavy_minus_sign: | If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. | +| `auto_enable` | *Optional[bool]* | :heavy_minus_sign: | If true, plan is automatically attached when a customer is created. Use for free tiers. | +| `price` | [Optional[models.CreatePlanPriceRequest]](../models/createplanpricerequest.md) | :heavy_minus_sign: | Base recurring price for the plan. Omit for free or usage-only plans. | +| `items` | List[[models.CreatePlanItemRequest](../models/createplanitemrequest.md)] | :heavy_minus_sign: | Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. | +| `free_trial` | [Optional[models.CreatePlanFreeTrialRequest]](../models/createplanfreetrialrequest.md) | :heavy_minus_sign: | Free trial configuration. Customers can try this plan before being charged. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanpricedisplay.md b/others/python-sdk/docs/models/createplanpricedisplay.md new file mode 100644 index 000000000..c329aa588 --- /dev/null +++ b/others/python-sdk/docs/models/createplanpricedisplay.md @@ -0,0 +1,11 @@ +# CreatePlanPriceDisplay + +Display text for showing this price in pricing pages. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primary_text` | *str* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanpriceintervalrequest.md b/others/python-sdk/docs/models/createplanpriceintervalrequest.md new file mode 100644 index 000000000..7d5a547c8 --- /dev/null +++ b/others/python-sdk/docs/models/createplanpriceintervalrequest.md @@ -0,0 +1,15 @@ +# CreatePlanPriceIntervalRequest + +Billing interval (e.g. 'month', 'year'). + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanpriceintervalresponse.md b/others/python-sdk/docs/models/createplanpriceintervalresponse.md new file mode 100644 index 000000000..3b55edf3f --- /dev/null +++ b/others/python-sdk/docs/models/createplanpriceintervalresponse.md @@ -0,0 +1,15 @@ +# CreatePlanPriceIntervalResponse + +Billing interval (e.g. 'month', 'year'). + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanpriceitemintervalresponse.md b/others/python-sdk/docs/models/createplanpriceitemintervalresponse.md new file mode 100644 index 000000000..505ffa295 --- /dev/null +++ b/others/python-sdk/docs/models/createplanpriceitemintervalresponse.md @@ -0,0 +1,15 @@ +# CreatePlanPriceItemIntervalResponse + +Billing interval for this price. For consumable features, should match reset.interval. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanpricerequest.md b/others/python-sdk/docs/models/createplanpricerequest.md new file mode 100644 index 000000000..b9d8ba0d1 --- /dev/null +++ b/others/python-sdk/docs/models/createplanpricerequest.md @@ -0,0 +1,12 @@ +# CreatePlanPriceRequest + +Base recurring price for the plan. Omit for free or usage-only plans. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `amount` | *float* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.CreatePlanPriceIntervalRequest](../models/createplanpriceintervalrequest.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanpriceresponse.md b/others/python-sdk/docs/models/createplanpriceresponse.md new file mode 100644 index 000000000..17a4e153d --- /dev/null +++ b/others/python-sdk/docs/models/createplanpriceresponse.md @@ -0,0 +1,11 @@ +# CreatePlanPriceResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `amount` | *float* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.CreatePlanPriceIntervalResponse](../models/createplanpriceintervalresponse.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `display` | [Optional[models.CreatePlanPriceDisplay]](../models/createplanpricedisplay.md) | :heavy_minus_sign: | Display text for showing this price in pricing pages. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanproration.md b/others/python-sdk/docs/models/createplanproration.md new file mode 100644 index 000000000..fefa0c8a1 --- /dev/null +++ b/others/python-sdk/docs/models/createplanproration.md @@ -0,0 +1,11 @@ +# CreatePlanProration + +Proration settings for prepaid features. Controls mid-cycle quantity change billing. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `on_increase` | [models.CreatePlanOnIncrease](../models/createplanonincrease.md) | :heavy_check_mark: | Billing behavior when quantity increases mid-cycle. | +| `on_decrease` | [models.CreatePlanOnDecrease](../models/createplanondecrease.md) | :heavy_check_mark: | Credit behavior when quantity decreases mid-cycle. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanresetintervalrequest.md b/others/python-sdk/docs/models/createplanresetintervalrequest.md new file mode 100644 index 000000000..b2afd01b4 --- /dev/null +++ b/others/python-sdk/docs/models/createplanresetintervalrequest.md @@ -0,0 +1,18 @@ +# CreatePlanResetIntervalRequest + +Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `MINUTE` | minute | +| `HOUR` | hour | +| `DAY` | day | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanresetintervalresponse.md b/others/python-sdk/docs/models/createplanresetintervalresponse.md new file mode 100644 index 000000000..fde9015d3 --- /dev/null +++ b/others/python-sdk/docs/models/createplanresetintervalresponse.md @@ -0,0 +1,18 @@ +# CreatePlanResetIntervalResponse + +The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `MINUTE` | minute | +| `HOUR` | hour | +| `DAY` | day | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanresetrequest.md b/others/python-sdk/docs/models/createplanresetrequest.md new file mode 100644 index 000000000..4a3159f5d --- /dev/null +++ b/others/python-sdk/docs/models/createplanresetrequest.md @@ -0,0 +1,11 @@ +# CreatePlanResetRequest + +Reset configuration for consumable features. Omit for non-consumable features like seats. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `interval` | [models.CreatePlanResetIntervalRequest](../models/createplanresetintervalrequest.md) | :heavy_check_mark: | Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanresetresponse.md b/others/python-sdk/docs/models/createplanresetresponse.md new file mode 100644 index 000000000..a2f64fdb4 --- /dev/null +++ b/others/python-sdk/docs/models/createplanresetresponse.md @@ -0,0 +1,9 @@ +# CreatePlanResetResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `interval` | [models.CreatePlanResetIntervalResponse](../models/createplanresetintervalresponse.md) | :heavy_check_mark: | The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanresponse.md b/others/python-sdk/docs/models/createplanresponse.md new file mode 100644 index 000000000..53fb0b125 --- /dev/null +++ b/others/python-sdk/docs/models/createplanresponse.md @@ -0,0 +1,23 @@ +# CreatePlanResponse + +A plan defines a set of features, pricing, and entitlements that can be attached to customers. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique identifier for the plan. | +| `name` | *str* | :heavy_check_mark: | Display name of the plan. | +| `description` | *Nullable[str]* | :heavy_check_mark: | Optional description of the plan. | +| `group` | *Nullable[str]* | :heavy_check_mark: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `version` | *float* | :heavy_check_mark: | Version number of the plan. Incremented when plan configuration changes. | +| `add_on` | *bool* | :heavy_check_mark: | Whether this is an add-on plan that can be attached alongside a main plan. | +| `auto_enable` | *bool* | :heavy_check_mark: | If true, this plan is automatically attached when a customer is created. Used for free plans. | +| `price` | [Nullable[models.CreatePlanPriceResponse]](../models/createplanpriceresponse.md) | :heavy_check_mark: | Base recurring price for the plan. Null for free plans or usage-only plans. | +| `items` | List[[models.CreatePlanItemResponse](../models/createplanitemresponse.md)] | :heavy_check_mark: | Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. | +| `free_trial` | [Optional[models.CreatePlanFreeTrialResponse]](../models/createplanfreetrialresponse.md) | :heavy_minus_sign: | Free trial configuration. If set, new customers can try this plan before being charged. | +| `created_at` | *float* | :heavy_check_mark: | Unix timestamp (ms) when the plan was created. | +| `env` | [models.CreatePlanEnv](../models/createplanenv.md) | :heavy_check_mark: | Environment this plan belongs to ('sandbox' or 'live'). | +| `archived` | *bool* | :heavy_check_mark: | Whether the plan is archived. Archived plans cannot be attached to new customers. | +| `base_variant_id` | *Nullable[str]* | :heavy_check_mark: | If this is a variant, the ID of the base plan it was created from. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanrolloverrequest.md b/others/python-sdk/docs/models/createplanrolloverrequest.md new file mode 100644 index 000000000..82631b761 --- /dev/null +++ b/others/python-sdk/docs/models/createplanrolloverrequest.md @@ -0,0 +1,12 @@ +# CreatePlanRolloverRequest + +Rollover config for unused units. If set, unused included units carry over. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `max` | *Optional[float]* | :heavy_minus_sign: | Max rollover units. Omit for unlimited rollover. | +| `expiry_duration_type` | [models.CreatePlanExpiryDurationTypeRequest](../models/createplanexpirydurationtyperequest.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplanrolloverresponse.md b/others/python-sdk/docs/models/createplanrolloverresponse.md new file mode 100644 index 000000000..1036a2ba0 --- /dev/null +++ b/others/python-sdk/docs/models/createplanrolloverresponse.md @@ -0,0 +1,12 @@ +# CreatePlanRolloverResponse + +Rollover configuration for unused units. If set, unused included units roll over to the next period. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `max` | *Nullable[float]* | :heavy_check_mark: | Maximum rollover units. Null for unlimited rollover. | +| `expiry_duration_type` | [models.CreatePlanExpiryDurationTypeResponse](../models/createplanexpirydurationtyperesponse.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplantierrequest.md b/others/python-sdk/docs/models/createplantierrequest.md new file mode 100644 index 000000000..ed4bff734 --- /dev/null +++ b/others/python-sdk/docs/models/createplantierrequest.md @@ -0,0 +1,9 @@ +# CreatePlanTierRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `to` | [models.CreatePlanToRequest](../models/createplantorequest.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplantierresponse.md b/others/python-sdk/docs/models/createplantierresponse.md new file mode 100644 index 000000000..ce4d81c7e --- /dev/null +++ b/others/python-sdk/docs/models/createplantierresponse.md @@ -0,0 +1,9 @@ +# CreatePlanTierResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `to` | [models.CreatePlanToResponse](../models/createplantoresponse.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createplantorequest.md b/others/python-sdk/docs/models/createplantorequest.md new file mode 100644 index 000000000..3e3a23373 --- /dev/null +++ b/others/python-sdk/docs/models/createplantorequest.md @@ -0,0 +1,17 @@ +# CreatePlanToRequest + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/createplantoresponse.md b/others/python-sdk/docs/models/createplantoresponse.md new file mode 100644 index 000000000..767b75b26 --- /dev/null +++ b/others/python-sdk/docs/models/createplantoresponse.md @@ -0,0 +1,17 @@ +# CreatePlanToResponse + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/createplantype.md b/others/python-sdk/docs/models/createplantype.md new file mode 100644 index 000000000..32d3faf1d --- /dev/null +++ b/others/python-sdk/docs/models/createplantype.md @@ -0,0 +1,14 @@ +# CreatePlanType + +The type of the feature + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `STATIC` | static | +| `BOOLEAN` | boolean | +| `SINGLE_USE` | single_use | +| `CONTINUOUS_USE` | continuous_use | +| `CREDIT_SYSTEM` | credit_system | \ No newline at end of file diff --git a/others/python-sdk/docs/models/customereligibility.md b/others/python-sdk/docs/models/customereligibility.md deleted file mode 100644 index 2bd1c2088..000000000 --- a/others/python-sdk/docs/models/customereligibility.md +++ /dev/null @@ -1,9 +0,0 @@ -# CustomerEligibility - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| `trial_available` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `scenario` | [models.Scenario](../models/scenario.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/deleteplanglobals.md b/others/python-sdk/docs/models/deleteplanglobals.md new file mode 100644 index 000000000..b2b6e9e65 --- /dev/null +++ b/others/python-sdk/docs/models/deleteplanglobals.md @@ -0,0 +1,8 @@ +# DeletePlanGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/deleteplanparams.md b/others/python-sdk/docs/models/deleteplanparams.md new file mode 100644 index 000000000..ed65bf7e0 --- /dev/null +++ b/others/python-sdk/docs/models/deleteplanparams.md @@ -0,0 +1,9 @@ +# DeletePlanParams + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan to delete. | +| `all_versions` | *Optional[bool]* | :heavy_minus_sign: | If true, deletes all versions of the plan. Otherwise, only deletes the latest version. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/deleteplanresponse.md b/others/python-sdk/docs/models/deleteplanresponse.md new file mode 100644 index 000000000..613f5798f --- /dev/null +++ b/others/python-sdk/docs/models/deleteplanresponse.md @@ -0,0 +1,10 @@ +# DeletePlanResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `success` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/expirydurationtype.md b/others/python-sdk/docs/models/expirydurationtype.md index d73f4f219..80366277f 100644 --- a/others/python-sdk/docs/models/expirydurationtype.md +++ b/others/python-sdk/docs/models/expirydurationtype.md @@ -1,5 +1,7 @@ # ExpiryDurationType +When rolled over units expire. + ## Values diff --git a/others/python-sdk/docs/models/freetrial.md b/others/python-sdk/docs/models/freetrial.md index 8a3193303..589d1bb1e 100644 --- a/others/python-sdk/docs/models/freetrial.md +++ b/others/python-sdk/docs/models/freetrial.md @@ -1,10 +1,12 @@ # FreeTrial +Free trial configuration. If set, new customers can try this plan before being charged. + ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `duration_length` | *float* | :heavy_check_mark: | N/A | -| `duration_type` | [models.PlanDurationType](../models/plandurationtype.md) | :heavy_check_mark: | N/A | -| `card_required` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `duration_length` | *float* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `duration_type` | [models.PlanDurationType](../models/plandurationtype.md) | :heavy_check_mark: | Unit of time for the trial duration ('day', 'month', 'year'). | +| `card_required` | *bool* | :heavy_check_mark: | Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanbillingmethod.md b/others/python-sdk/docs/models/getplanbillingmethod.md new file mode 100644 index 000000000..d8b089d97 --- /dev/null +++ b/others/python-sdk/docs/models/getplanbillingmethod.md @@ -0,0 +1,11 @@ +# GetPlanBillingMethod + +'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `PREPAID` | prepaid | +| `USAGE_BASED` | usage_based | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplancreditschema.md b/others/python-sdk/docs/models/getplancreditschema.md new file mode 100644 index 000000000..1f3b4e20a --- /dev/null +++ b/others/python-sdk/docs/models/getplancreditschema.md @@ -0,0 +1,9 @@ +# GetPlanCreditSchema + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `metered_feature_id` | *str* | :heavy_check_mark: | The ID of the metered feature (should be a single_use feature). | +| `credit_cost` | *float* | :heavy_check_mark: | The credit cost of the metered feature. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplandurationtype.md b/others/python-sdk/docs/models/getplandurationtype.md new file mode 100644 index 000000000..5f2992194 --- /dev/null +++ b/others/python-sdk/docs/models/getplandurationtype.md @@ -0,0 +1,12 @@ +# GetPlanDurationType + +Unit of time for the trial duration ('day', 'month', 'year'). + + +## Values + +| Name | Value | +| ------- | ------- | +| `DAY` | day | +| `MONTH` | month | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanenv.md b/others/python-sdk/docs/models/getplanenv.md new file mode 100644 index 000000000..b8d4c39f8 --- /dev/null +++ b/others/python-sdk/docs/models/getplanenv.md @@ -0,0 +1,11 @@ +# GetPlanEnv + +Environment this plan belongs to ('sandbox' or 'live'). + + +## Values + +| Name | Value | +| --------- | --------- | +| `SANDBOX` | sandbox | +| `LIVE` | live | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanexpirydurationtype.md b/others/python-sdk/docs/models/getplanexpirydurationtype.md new file mode 100644 index 000000000..d12769965 --- /dev/null +++ b/others/python-sdk/docs/models/getplanexpirydurationtype.md @@ -0,0 +1,11 @@ +# GetPlanExpiryDurationType + +When rolled over units expire. + + +## Values + +| Name | Value | +| --------- | --------- | +| `MONTH` | month | +| `FOREVER` | forever | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanfeature.md b/others/python-sdk/docs/models/getplanfeature.md new file mode 100644 index 000000000..d02645f41 --- /dev/null +++ b/others/python-sdk/docs/models/getplanfeature.md @@ -0,0 +1,15 @@ +# GetPlanFeature + +The full feature object if expanded. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `id` | *str* | :heavy_check_mark: | The ID of the feature, used to refer to it in other API calls like /track or /check. | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the feature. | +| `type` | [models.GetPlanType](../models/getplantype.md) | :heavy_check_mark: | The type of the feature | +| `display` | [OptionalNullable[models.GetPlanFeatureDisplay]](../models/getplanfeaturedisplay.md) | :heavy_minus_sign: | Singular and plural display names for the feature. | +| `credit_schema` | List[[models.GetPlanCreditSchema](../models/getplancreditschema.md)] | :heavy_minus_sign: | Credit cost schema for credit system features. | +| `archived` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether or not the feature is archived. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanfeaturedisplay.md b/others/python-sdk/docs/models/getplanfeaturedisplay.md new file mode 100644 index 000000000..c97bd2442 --- /dev/null +++ b/others/python-sdk/docs/models/getplanfeaturedisplay.md @@ -0,0 +1,9 @@ +# GetPlanFeatureDisplay + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `singular` | *str* | :heavy_check_mark: | The singular display name for the feature. | +| `plural` | *str* | :heavy_check_mark: | The plural display name for the feature. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanfreetrial.md b/others/python-sdk/docs/models/getplanfreetrial.md new file mode 100644 index 000000000..b7217f769 --- /dev/null +++ b/others/python-sdk/docs/models/getplanfreetrial.md @@ -0,0 +1,12 @@ +# GetPlanFreeTrial + +Free trial configuration. If set, new customers can try this plan before being charged. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `duration_length` | *float* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `duration_type` | [models.GetPlanDurationType](../models/getplandurationtype.md) | :heavy_check_mark: | Unit of time for the trial duration ('day', 'month', 'year'). | +| `card_required` | *bool* | :heavy_check_mark: | Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanglobals.md b/others/python-sdk/docs/models/getplanglobals.md new file mode 100644 index 000000000..32425a06c --- /dev/null +++ b/others/python-sdk/docs/models/getplanglobals.md @@ -0,0 +1,8 @@ +# GetPlanGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanitem.md b/others/python-sdk/docs/models/getplanitem.md new file mode 100644 index 000000000..e2e5067aa --- /dev/null +++ b/others/python-sdk/docs/models/getplanitem.md @@ -0,0 +1,15 @@ +# GetPlanItem + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature this item configures. | +| `feature` | [Optional[models.GetPlanFeature]](../models/getplanfeature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `included` | *float* | :heavy_check_mark: | Number of free units included. For consumable features, balance resets to this number each interval. | +| `unlimited` | *bool* | :heavy_check_mark: | Whether the customer has unlimited access to this feature. | +| `reset` | [Nullable[models.GetPlanReset]](../models/getplanreset.md) | :heavy_check_mark: | Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. | +| `price` | [Nullable[models.GetPlanItemPrice]](../models/getplanitemprice.md) | :heavy_check_mark: | Pricing configuration for usage beyond included units. Null if feature is entirely free. | +| `display` | [Optional[models.GetPlanItemDisplay]](../models/getplanitemdisplay.md) | :heavy_minus_sign: | Display text for showing this item in pricing pages. | +| `rollover` | [Optional[models.GetPlanRollover]](../models/getplanrollover.md) | :heavy_minus_sign: | Rollover configuration for unused units. If set, unused included units roll over to the next period. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanitemdisplay.md b/others/python-sdk/docs/models/getplanitemdisplay.md new file mode 100644 index 000000000..6728190d3 --- /dev/null +++ b/others/python-sdk/docs/models/getplanitemdisplay.md @@ -0,0 +1,11 @@ +# GetPlanItemDisplay + +Display text for showing this item in pricing pages. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primary_text` | *str* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanitemprice.md b/others/python-sdk/docs/models/getplanitemprice.md new file mode 100644 index 000000000..254d6ea5d --- /dev/null +++ b/others/python-sdk/docs/models/getplanitemprice.md @@ -0,0 +1,14 @@ +# GetPlanItemPrice + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[float]* | :heavy_minus_sign: | Price per billing_units after included usage is consumed. Mutually exclusive with tiers. | +| `tiers` | List[[models.GetPlanTier](../models/getplantier.md)] | :heavy_minus_sign: | Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. | +| `interval` | [models.GetPlanPriceItemInterval](../models/getplanpriceiteminterval.md) | :heavy_check_mark: | Billing interval for this price. For consumable features, should match reset.interval. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billing_units` | *float* | :heavy_check_mark: | Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). | +| `billing_method` | [models.GetPlanBillingMethod](../models/getplanbillingmethod.md) | :heavy_check_mark: | 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. | +| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanparams.md b/others/python-sdk/docs/models/getplanparams.md new file mode 100644 index 000000000..e291baf6a --- /dev/null +++ b/others/python-sdk/docs/models/getplanparams.md @@ -0,0 +1,9 @@ +# GetPlanParams + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan to retrieve. | +| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to get. Defaults to the latest version. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanprice.md b/others/python-sdk/docs/models/getplanprice.md new file mode 100644 index 000000000..ece95509a --- /dev/null +++ b/others/python-sdk/docs/models/getplanprice.md @@ -0,0 +1,11 @@ +# GetPlanPrice + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `amount` | *float* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.GetPlanPriceInterval](../models/getplanpriceinterval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `display` | [Optional[models.GetPlanPriceDisplay]](../models/getplanpricedisplay.md) | :heavy_minus_sign: | Display text for showing this price in pricing pages. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanpricedisplay.md b/others/python-sdk/docs/models/getplanpricedisplay.md new file mode 100644 index 000000000..bcbad67a2 --- /dev/null +++ b/others/python-sdk/docs/models/getplanpricedisplay.md @@ -0,0 +1,11 @@ +# GetPlanPriceDisplay + +Display text for showing this price in pricing pages. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primary_text` | *str* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanpriceinterval.md b/others/python-sdk/docs/models/getplanpriceinterval.md new file mode 100644 index 000000000..3370145b9 --- /dev/null +++ b/others/python-sdk/docs/models/getplanpriceinterval.md @@ -0,0 +1,15 @@ +# GetPlanPriceInterval + +Billing interval (e.g. 'month', 'year'). + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanpriceiteminterval.md b/others/python-sdk/docs/models/getplanpriceiteminterval.md new file mode 100644 index 000000000..4da7249fe --- /dev/null +++ b/others/python-sdk/docs/models/getplanpriceiteminterval.md @@ -0,0 +1,15 @@ +# GetPlanPriceItemInterval + +Billing interval for this price. For consumable features, should match reset.interval. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanreset.md b/others/python-sdk/docs/models/getplanreset.md new file mode 100644 index 000000000..2ad13f83a --- /dev/null +++ b/others/python-sdk/docs/models/getplanreset.md @@ -0,0 +1,9 @@ +# GetPlanReset + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `interval` | [models.GetPlanResetInterval](../models/getplanresetinterval.md) | :heavy_check_mark: | The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanresetinterval.md b/others/python-sdk/docs/models/getplanresetinterval.md new file mode 100644 index 000000000..f89ea0c64 --- /dev/null +++ b/others/python-sdk/docs/models/getplanresetinterval.md @@ -0,0 +1,18 @@ +# GetPlanResetInterval + +The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `MINUTE` | minute | +| `HOUR` | hour | +| `DAY` | day | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanresponse.md b/others/python-sdk/docs/models/getplanresponse.md new file mode 100644 index 000000000..dfb53b24d --- /dev/null +++ b/others/python-sdk/docs/models/getplanresponse.md @@ -0,0 +1,23 @@ +# GetPlanResponse + +A plan defines a set of features, pricing, and entitlements that can be attached to customers. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique identifier for the plan. | +| `name` | *str* | :heavy_check_mark: | Display name of the plan. | +| `description` | *Nullable[str]* | :heavy_check_mark: | Optional description of the plan. | +| `group` | *Nullable[str]* | :heavy_check_mark: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `version` | *float* | :heavy_check_mark: | Version number of the plan. Incremented when plan configuration changes. | +| `add_on` | *bool* | :heavy_check_mark: | Whether this is an add-on plan that can be attached alongside a main plan. | +| `auto_enable` | *bool* | :heavy_check_mark: | If true, this plan is automatically attached when a customer is created. Used for free plans. | +| `price` | [Nullable[models.GetPlanPrice]](../models/getplanprice.md) | :heavy_check_mark: | Base recurring price for the plan. Null for free plans or usage-only plans. | +| `items` | List[[models.GetPlanItem](../models/getplanitem.md)] | :heavy_check_mark: | Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. | +| `free_trial` | [Optional[models.GetPlanFreeTrial]](../models/getplanfreetrial.md) | :heavy_minus_sign: | Free trial configuration. If set, new customers can try this plan before being charged. | +| `created_at` | *float* | :heavy_check_mark: | Unix timestamp (ms) when the plan was created. | +| `env` | [models.GetPlanEnv](../models/getplanenv.md) | :heavy_check_mark: | Environment this plan belongs to ('sandbox' or 'live'). | +| `archived` | *bool* | :heavy_check_mark: | Whether the plan is archived. Archived plans cannot be attached to new customers. | +| `base_variant_id` | *Nullable[str]* | :heavy_check_mark: | If this is a variant, the ID of the base plan it was created from. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanrollover.md b/others/python-sdk/docs/models/getplanrollover.md new file mode 100644 index 000000000..d6778e26e --- /dev/null +++ b/others/python-sdk/docs/models/getplanrollover.md @@ -0,0 +1,12 @@ +# GetPlanRollover + +Rollover configuration for unused units. If set, unused included units roll over to the next period. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `max` | *Nullable[float]* | :heavy_check_mark: | Maximum rollover units. Null for unlimited rollover. | +| `expiry_duration_type` | [models.GetPlanExpiryDurationType](../models/getplanexpirydurationtype.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplantier.md b/others/python-sdk/docs/models/getplantier.md new file mode 100644 index 000000000..bf914d4d7 --- /dev/null +++ b/others/python-sdk/docs/models/getplantier.md @@ -0,0 +1,9 @@ +# GetPlanTier + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `to` | [models.GetPlanTo](../models/getplanto.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getplanto.md b/others/python-sdk/docs/models/getplanto.md new file mode 100644 index 000000000..954d44b1f --- /dev/null +++ b/others/python-sdk/docs/models/getplanto.md @@ -0,0 +1,17 @@ +# GetPlanTo + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/getplantype.md b/others/python-sdk/docs/models/getplantype.md new file mode 100644 index 000000000..64f5d6104 --- /dev/null +++ b/others/python-sdk/docs/models/getplantype.md @@ -0,0 +1,14 @@ +# GetPlanType + +The type of the feature + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `STATIC` | static | +| `BOOLEAN` | boolean | +| `SINGLE_USE` | single_use | +| `CONTINUOUS_USE` | continuous_use | +| `CREDIT_SYSTEM` | credit_system | \ No newline at end of file diff --git a/others/python-sdk/docs/models/item.md b/others/python-sdk/docs/models/item.md index 46f65fabe..cfe1e3331 100644 --- a/others/python-sdk/docs/models/item.md +++ b/others/python-sdk/docs/models/item.md @@ -3,14 +3,13 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `feature` | [Optional[models.PlanFeature]](../models/planfeature.md) | :heavy_minus_sign: | N/A | -| `included` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `reset` | [Nullable[models.PlanReset]](../models/planreset.md) | :heavy_check_mark: | N/A | -| `price` | [Nullable[models.PlanItemPrice]](../models/planitemprice.md) | :heavy_check_mark: | N/A | -| `display` | [Optional[models.PlanItemDisplay]](../models/planitemdisplay.md) | :heavy_minus_sign: | N/A | -| `rollover` | [Optional[models.PlanRollover]](../models/planrollover.md) | :heavy_minus_sign: | N/A | -| `proration` | [Optional[models.Proration]](../models/proration.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature this item configures. | +| `feature` | [Optional[models.PlanFeature]](../models/planfeature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `included` | *float* | :heavy_check_mark: | Number of free units included. For consumable features, balance resets to this number each interval. | +| `unlimited` | *bool* | :heavy_check_mark: | Whether the customer has unlimited access to this feature. | +| `reset` | [Nullable[models.PlanReset]](../models/planreset.md) | :heavy_check_mark: | Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. | +| `price` | [Nullable[models.PlanItemPrice]](../models/planitemprice.md) | :heavy_check_mark: | Pricing configuration for usage beyond included units. Null if feature is entirely free. | +| `display` | [Optional[models.PlanItemDisplay]](../models/planitemdisplay.md) | :heavy_minus_sign: | Display text for showing this item in pricing pages. | +| `rollover` | [Optional[models.PlanRollover]](../models/planrollover.md) | :heavy_minus_sign: | Rollover configuration for unused units. If set, unused included units roll over to the next period. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansbillingmethod.md b/others/python-sdk/docs/models/listplansbillingmethod.md new file mode 100644 index 000000000..fbfdc8106 --- /dev/null +++ b/others/python-sdk/docs/models/listplansbillingmethod.md @@ -0,0 +1,11 @@ +# ListPlansBillingMethod + +'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `PREPAID` | prepaid | +| `USAGE_BASED` | usage_based | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplanscreditschema.md b/others/python-sdk/docs/models/listplanscreditschema.md new file mode 100644 index 000000000..b956d783f --- /dev/null +++ b/others/python-sdk/docs/models/listplanscreditschema.md @@ -0,0 +1,9 @@ +# ListPlansCreditSchema + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `metered_feature_id` | *str* | :heavy_check_mark: | The ID of the metered feature (should be a single_use feature). | +| `credit_cost` | *float* | :heavy_check_mark: | The credit cost of the metered feature. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansdurationtype.md b/others/python-sdk/docs/models/listplansdurationtype.md new file mode 100644 index 000000000..d717ad36f --- /dev/null +++ b/others/python-sdk/docs/models/listplansdurationtype.md @@ -0,0 +1,12 @@ +# ListPlansDurationType + +Unit of time for the trial duration ('day', 'month', 'year'). + + +## Values + +| Name | Value | +| ------- | ------- | +| `DAY` | day | +| `MONTH` | month | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansenv.md b/others/python-sdk/docs/models/listplansenv.md new file mode 100644 index 000000000..02c29dfc7 --- /dev/null +++ b/others/python-sdk/docs/models/listplansenv.md @@ -0,0 +1,11 @@ +# ListPlansEnv + +Environment this plan belongs to ('sandbox' or 'live'). + + +## Values + +| Name | Value | +| --------- | --------- | +| `SANDBOX` | sandbox | +| `LIVE` | live | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansexpirydurationtype.md b/others/python-sdk/docs/models/listplansexpirydurationtype.md new file mode 100644 index 000000000..1a2b7ca1f --- /dev/null +++ b/others/python-sdk/docs/models/listplansexpirydurationtype.md @@ -0,0 +1,11 @@ +# ListPlansExpiryDurationType + +When rolled over units expire. + + +## Values + +| Name | Value | +| --------- | --------- | +| `MONTH` | month | +| `FOREVER` | forever | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansfeature.md b/others/python-sdk/docs/models/listplansfeature.md new file mode 100644 index 000000000..fdd24f745 --- /dev/null +++ b/others/python-sdk/docs/models/listplansfeature.md @@ -0,0 +1,15 @@ +# ListPlansFeature + +The full feature object if expanded. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The ID of the feature, used to refer to it in other API calls like /track or /check. | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the feature. | +| `type` | [models.ListPlansType](../models/listplanstype.md) | :heavy_check_mark: | The type of the feature | +| `display` | [OptionalNullable[models.ListPlansFeatureDisplay]](../models/listplansfeaturedisplay.md) | :heavy_minus_sign: | Singular and plural display names for the feature. | +| `credit_schema` | List[[models.ListPlansCreditSchema](../models/listplanscreditschema.md)] | :heavy_minus_sign: | Credit cost schema for credit system features. | +| `archived` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether or not the feature is archived. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansfeaturedisplay.md b/others/python-sdk/docs/models/listplansfeaturedisplay.md new file mode 100644 index 000000000..3db729eb1 --- /dev/null +++ b/others/python-sdk/docs/models/listplansfeaturedisplay.md @@ -0,0 +1,9 @@ +# ListPlansFeatureDisplay + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `singular` | *str* | :heavy_check_mark: | The singular display name for the feature. | +| `plural` | *str* | :heavy_check_mark: | The plural display name for the feature. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansfreetrial.md b/others/python-sdk/docs/models/listplansfreetrial.md new file mode 100644 index 000000000..9db93e0a4 --- /dev/null +++ b/others/python-sdk/docs/models/listplansfreetrial.md @@ -0,0 +1,12 @@ +# ListPlansFreeTrial + +Free trial configuration. If set, new customers can try this plan before being charged. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `duration_length` | *float* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `duration_type` | [models.ListPlansDurationType](../models/listplansdurationtype.md) | :heavy_check_mark: | Unit of time for the trial duration ('day', 'month', 'year'). | +| `card_required` | *bool* | :heavy_check_mark: | Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansitem.md b/others/python-sdk/docs/models/listplansitem.md new file mode 100644 index 000000000..d2b69ffef --- /dev/null +++ b/others/python-sdk/docs/models/listplansitem.md @@ -0,0 +1,15 @@ +# ListPlansItem + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature this item configures. | +| `feature` | [Optional[models.ListPlansFeature]](../models/listplansfeature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `included` | *float* | :heavy_check_mark: | Number of free units included. For consumable features, balance resets to this number each interval. | +| `unlimited` | *bool* | :heavy_check_mark: | Whether the customer has unlimited access to this feature. | +| `reset` | [Nullable[models.ListPlansReset]](../models/listplansreset.md) | :heavy_check_mark: | Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. | +| `price` | [Nullable[models.ListPlansItemPrice]](../models/listplansitemprice.md) | :heavy_check_mark: | Pricing configuration for usage beyond included units. Null if feature is entirely free. | +| `display` | [Optional[models.ListPlansItemDisplay]](../models/listplansitemdisplay.md) | :heavy_minus_sign: | Display text for showing this item in pricing pages. | +| `rollover` | [Optional[models.ListPlansRollover]](../models/listplansrollover.md) | :heavy_minus_sign: | Rollover configuration for unused units. If set, unused included units roll over to the next period. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansitemdisplay.md b/others/python-sdk/docs/models/listplansitemdisplay.md new file mode 100644 index 000000000..fed159e83 --- /dev/null +++ b/others/python-sdk/docs/models/listplansitemdisplay.md @@ -0,0 +1,11 @@ +# ListPlansItemDisplay + +Display text for showing this item in pricing pages. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primary_text` | *str* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansitemprice.md b/others/python-sdk/docs/models/listplansitemprice.md new file mode 100644 index 000000000..844908867 --- /dev/null +++ b/others/python-sdk/docs/models/listplansitemprice.md @@ -0,0 +1,14 @@ +# ListPlansItemPrice + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[float]* | :heavy_minus_sign: | Price per billing_units after included usage is consumed. Mutually exclusive with tiers. | +| `tiers` | List[[models.ListPlansTier](../models/listplanstier.md)] | :heavy_minus_sign: | Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. | +| `interval` | [models.ListPlansPriceItemInterval](../models/listplanspriceiteminterval.md) | :heavy_check_mark: | Billing interval for this price. For consumable features, should match reset.interval. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billing_units` | *float* | :heavy_check_mark: | Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). | +| `billing_method` | [models.ListPlansBillingMethod](../models/listplansbillingmethod.md) | :heavy_check_mark: | 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. | +| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplanslist.md b/others/python-sdk/docs/models/listplanslist.md new file mode 100644 index 000000000..40d160c51 --- /dev/null +++ b/others/python-sdk/docs/models/listplanslist.md @@ -0,0 +1,23 @@ +# ListPlansList + +A plan defines a set of features, pricing, and entitlements that can be attached to customers. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique identifier for the plan. | +| `name` | *str* | :heavy_check_mark: | Display name of the plan. | +| `description` | *Nullable[str]* | :heavy_check_mark: | Optional description of the plan. | +| `group` | *Nullable[str]* | :heavy_check_mark: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `version` | *float* | :heavy_check_mark: | Version number of the plan. Incremented when plan configuration changes. | +| `add_on` | *bool* | :heavy_check_mark: | Whether this is an add-on plan that can be attached alongside a main plan. | +| `auto_enable` | *bool* | :heavy_check_mark: | If true, this plan is automatically attached when a customer is created. Used for free plans. | +| `price` | [Nullable[models.ListPlansPrice]](../models/listplansprice.md) | :heavy_check_mark: | Base recurring price for the plan. Null for free plans or usage-only plans. | +| `items` | List[[models.ListPlansItem](../models/listplansitem.md)] | :heavy_check_mark: | Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. | +| `free_trial` | [Optional[models.ListPlansFreeTrial]](../models/listplansfreetrial.md) | :heavy_minus_sign: | Free trial configuration. If set, new customers can try this plan before being charged. | +| `created_at` | *float* | :heavy_check_mark: | Unix timestamp (ms) when the plan was created. | +| `env` | [models.ListPlansEnv](../models/listplansenv.md) | :heavy_check_mark: | Environment this plan belongs to ('sandbox' or 'live'). | +| `archived` | *bool* | :heavy_check_mark: | Whether the plan is archived. Archived plans cannot be attached to new customers. | +| `base_variant_id` | *Nullable[str]* | :heavy_check_mark: | If this is a variant, the ID of the base plan it was created from. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansparams.md b/others/python-sdk/docs/models/listplansparams.md new file mode 100644 index 000000000..b78c6ee19 --- /dev/null +++ b/others/python-sdk/docs/models/listplansparams.md @@ -0,0 +1,10 @@ +# ListPlansParams + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `customer_id` | *Optional[str]* | :heavy_minus_sign: | Customer ID to include eligibility info (trial availability, attach scenario). | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | Entity ID for entity-scoped plans. | +| `include_archived` | *Optional[bool]* | :heavy_minus_sign: | If true, includes archived plans in the response. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansprice.md b/others/python-sdk/docs/models/listplansprice.md new file mode 100644 index 000000000..aa0e6c4b7 --- /dev/null +++ b/others/python-sdk/docs/models/listplansprice.md @@ -0,0 +1,11 @@ +# ListPlansPrice + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `amount` | *float* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.ListPlansPriceInterval](../models/listplanspriceinterval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `display` | [Optional[models.ListPlansPriceDisplay]](../models/listplanspricedisplay.md) | :heavy_minus_sign: | Display text for showing this price in pricing pages. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplanspricedisplay.md b/others/python-sdk/docs/models/listplanspricedisplay.md new file mode 100644 index 000000000..183984624 --- /dev/null +++ b/others/python-sdk/docs/models/listplanspricedisplay.md @@ -0,0 +1,11 @@ +# ListPlansPriceDisplay + +Display text for showing this price in pricing pages. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primary_text` | *str* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplanspriceinterval.md b/others/python-sdk/docs/models/listplanspriceinterval.md new file mode 100644 index 000000000..2a8a39f8a --- /dev/null +++ b/others/python-sdk/docs/models/listplanspriceinterval.md @@ -0,0 +1,15 @@ +# ListPlansPriceInterval + +Billing interval (e.g. 'month', 'year'). + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplanspriceiteminterval.md b/others/python-sdk/docs/models/listplanspriceiteminterval.md new file mode 100644 index 000000000..9f629477a --- /dev/null +++ b/others/python-sdk/docs/models/listplanspriceiteminterval.md @@ -0,0 +1,15 @@ +# ListPlansPriceItemInterval + +Billing interval for this price. For consumable features, should match reset.interval. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansrequest.md b/others/python-sdk/docs/models/listplansrequest.md deleted file mode 100644 index c6cd640e1..000000000 --- a/others/python-sdk/docs/models/listplansrequest.md +++ /dev/null @@ -1,10 +0,0 @@ -# ListPlansRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `customer_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `entity_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `include_archived` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansreset.md b/others/python-sdk/docs/models/listplansreset.md new file mode 100644 index 000000000..d2d1fc44a --- /dev/null +++ b/others/python-sdk/docs/models/listplansreset.md @@ -0,0 +1,9 @@ +# ListPlansReset + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `interval` | [models.ListPlansResetInterval](../models/listplansresetinterval.md) | :heavy_check_mark: | The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansresetinterval.md b/others/python-sdk/docs/models/listplansresetinterval.md new file mode 100644 index 000000000..3801f20f4 --- /dev/null +++ b/others/python-sdk/docs/models/listplansresetinterval.md @@ -0,0 +1,18 @@ +# ListPlansResetInterval + +The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `MINUTE` | minute | +| `HOUR` | hour | +| `DAY` | day | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansresponse.md b/others/python-sdk/docs/models/listplansresponse.md index 35e5ec6c2..0849fd982 100644 --- a/others/python-sdk/docs/models/listplansresponse.md +++ b/others/python-sdk/docs/models/listplansresponse.md @@ -5,6 +5,6 @@ OK ## Fields -| Field | Type | Required | Description | -| -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- | -| `list` | List[[models.Plan](../models/plan.md)] | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `list` | List[[models.ListPlansList](../models/listplanslist.md)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansrollover.md b/others/python-sdk/docs/models/listplansrollover.md new file mode 100644 index 000000000..b1465a838 --- /dev/null +++ b/others/python-sdk/docs/models/listplansrollover.md @@ -0,0 +1,12 @@ +# ListPlansRollover + +Rollover configuration for unused units. If set, unused included units roll over to the next period. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `max` | *Nullable[float]* | :heavy_check_mark: | Maximum rollover units. Null for unlimited rollover. | +| `expiry_duration_type` | [models.ListPlansExpiryDurationType](../models/listplansexpirydurationtype.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplanstier.md b/others/python-sdk/docs/models/listplanstier.md new file mode 100644 index 000000000..01472ab68 --- /dev/null +++ b/others/python-sdk/docs/models/listplanstier.md @@ -0,0 +1,9 @@ +# ListPlansTier + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | +| `to` | [models.ListPlansTo](../models/listplansto.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listplansto.md b/others/python-sdk/docs/models/listplansto.md new file mode 100644 index 000000000..032fa3f4f --- /dev/null +++ b/others/python-sdk/docs/models/listplansto.md @@ -0,0 +1,17 @@ +# ListPlansTo + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/listplanstype.md b/others/python-sdk/docs/models/listplanstype.md new file mode 100644 index 000000000..f5cdaa931 --- /dev/null +++ b/others/python-sdk/docs/models/listplanstype.md @@ -0,0 +1,14 @@ +# ListPlansType + +The type of the feature + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `STATIC` | static | +| `BOOLEAN` | boolean | +| `SINGLE_USE` | single_use | +| `CONTINUOUS_USE` | continuous_use | +| `CREDIT_SYSTEM` | credit_system | \ No newline at end of file diff --git a/others/python-sdk/docs/models/plan.md b/others/python-sdk/docs/models/plan.md index e57ad9041..eff391298 100644 --- a/others/python-sdk/docs/models/plan.md +++ b/others/python-sdk/docs/models/plan.md @@ -3,20 +3,19 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `id` | *str* | :heavy_check_mark: | N/A | -| `name` | *str* | :heavy_check_mark: | N/A | -| `description` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `group` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `version` | *float* | :heavy_check_mark: | N/A | -| `add_on` | *bool* | :heavy_check_mark: | N/A | -| `auto_enable` | *bool* | :heavy_check_mark: | N/A | -| `price` | [Nullable[models.PlanPrice]](../models/planprice.md) | :heavy_check_mark: | N/A | -| `items` | List[[models.Item](../models/item.md)] | :heavy_check_mark: | N/A | -| `free_trial` | [Optional[models.FreeTrial]](../models/freetrial.md) | :heavy_minus_sign: | N/A | -| `created_at` | *float* | :heavy_check_mark: | N/A | -| `env` | [models.PlanEnv](../models/planenv.md) | :heavy_check_mark: | N/A | -| `archived` | *bool* | :heavy_check_mark: | N/A | -| `base_variant_id` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `customer_eligibility` | [Optional[models.CustomerEligibility]](../models/customereligibility.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique identifier for the plan. | +| `name` | *str* | :heavy_check_mark: | Display name of the plan. | +| `description` | *Nullable[str]* | :heavy_check_mark: | Optional description of the plan. | +| `group` | *Nullable[str]* | :heavy_check_mark: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `version` | *float* | :heavy_check_mark: | Version number of the plan. Incremented when plan configuration changes. | +| `add_on` | *bool* | :heavy_check_mark: | Whether this is an add-on plan that can be attached alongside a main plan. | +| `auto_enable` | *bool* | :heavy_check_mark: | If true, this plan is automatically attached when a customer is created. Used for free plans. | +| `price` | [Nullable[models.PlanPrice]](../models/planprice.md) | :heavy_check_mark: | Base recurring price for the plan. Null for free plans or usage-only plans. | +| `items` | List[[models.Item](../models/item.md)] | :heavy_check_mark: | Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. | +| `free_trial` | [Optional[models.FreeTrial]](../models/freetrial.md) | :heavy_minus_sign: | Free trial configuration. If set, new customers can try this plan before being charged. | +| `created_at` | *float* | :heavy_check_mark: | Unix timestamp (ms) when the plan was created. | +| `env` | [models.PlanEnv](../models/planenv.md) | :heavy_check_mark: | Environment this plan belongs to ('sandbox' or 'live'). | +| `archived` | *bool* | :heavy_check_mark: | Whether the plan is archived. Archived plans cannot be attached to new customers. | +| `base_variant_id` | *Nullable[str]* | :heavy_check_mark: | If this is a variant, the ID of the base plan it was created from. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/planbillingmethod.md b/others/python-sdk/docs/models/planbillingmethod.md index 94bdd58e5..4aa20f7a7 100644 --- a/others/python-sdk/docs/models/planbillingmethod.md +++ b/others/python-sdk/docs/models/planbillingmethod.md @@ -1,5 +1,7 @@ # PlanBillingMethod +'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + ## Values diff --git a/others/python-sdk/docs/models/plandurationtype.md b/others/python-sdk/docs/models/plandurationtype.md index f3977f1f0..251f2b661 100644 --- a/others/python-sdk/docs/models/plandurationtype.md +++ b/others/python-sdk/docs/models/plandurationtype.md @@ -1,5 +1,7 @@ # PlanDurationType +Unit of time for the trial duration ('day', 'month', 'year'). + ## Values diff --git a/others/python-sdk/docs/models/planenv.md b/others/python-sdk/docs/models/planenv.md index da89cacf4..2357a78ef 100644 --- a/others/python-sdk/docs/models/planenv.md +++ b/others/python-sdk/docs/models/planenv.md @@ -1,5 +1,7 @@ # PlanEnv +Environment this plan belongs to ('sandbox' or 'live'). + ## Values diff --git a/others/python-sdk/docs/models/planfeature.md b/others/python-sdk/docs/models/planfeature.md index c479f3666..209c71d99 100644 --- a/others/python-sdk/docs/models/planfeature.md +++ b/others/python-sdk/docs/models/planfeature.md @@ -1,5 +1,7 @@ # PlanFeature +The full feature object if expanded. + ## Fields diff --git a/others/python-sdk/docs/models/planitemdisplay.md b/others/python-sdk/docs/models/planitemdisplay.md index bb425df1d..aed40400d 100644 --- a/others/python-sdk/docs/models/planitemdisplay.md +++ b/others/python-sdk/docs/models/planitemdisplay.md @@ -1,9 +1,11 @@ # PlanItemDisplay +Display text for showing this item in pricing pages. + ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `primary_text` | *str* | :heavy_check_mark: | N/A | -| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primary_text` | *str* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/planitemprice.md b/others/python-sdk/docs/models/planitemprice.md index c4e45c975..ed5a320d6 100644 --- a/others/python-sdk/docs/models/planitemprice.md +++ b/others/python-sdk/docs/models/planitemprice.md @@ -3,12 +3,12 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.PlanTier](../models/plantier.md)] | :heavy_minus_sign: | N/A | -| `interval` | [models.PlanPriceItemInterval](../models/planpriceiteminterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `billing_units` | *float* | :heavy_check_mark: | N/A | -| `billing_method` | [models.PlanBillingMethod](../models/planbillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[float]* | :heavy_minus_sign: | Price per billing_units after included usage is consumed. Mutually exclusive with tiers. | +| `tiers` | List[[models.PlanTier](../models/plantier.md)] | :heavy_minus_sign: | Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. | +| `interval` | [models.PlanPriceItemInterval](../models/planpriceiteminterval.md) | :heavy_check_mark: | Billing interval for this price. For consumable features, should match reset.interval. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billing_units` | *float* | :heavy_check_mark: | Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). | +| `billing_method` | [models.PlanBillingMethod](../models/planbillingmethod.md) | :heavy_check_mark: | 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. | +| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/planprice.md b/others/python-sdk/docs/models/planprice.md index eeeb9a00f..c5b23df2f 100644 --- a/others/python-sdk/docs/models/planprice.md +++ b/others/python-sdk/docs/models/planprice.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `amount` | *float* | :heavy_check_mark: | N/A | -| `interval` | [models.PlanPriceInterval](../models/planpriceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `display` | [Optional[models.PriceDisplay]](../models/pricedisplay.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `amount` | *float* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.PlanPriceInterval](../models/planpriceinterval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `display` | [Optional[models.PlanPriceDisplay]](../models/planpricedisplay.md) | :heavy_minus_sign: | Display text for showing this price in pricing pages. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/planpricedisplay.md b/others/python-sdk/docs/models/planpricedisplay.md new file mode 100644 index 000000000..b28dbe1c0 --- /dev/null +++ b/others/python-sdk/docs/models/planpricedisplay.md @@ -0,0 +1,11 @@ +# PlanPriceDisplay + +Display text for showing this price in pricing pages. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primary_text` | *str* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/planpriceinterval.md b/others/python-sdk/docs/models/planpriceinterval.md index cffc7ebba..3c6bfe6cc 100644 --- a/others/python-sdk/docs/models/planpriceinterval.md +++ b/others/python-sdk/docs/models/planpriceinterval.md @@ -1,5 +1,7 @@ # PlanPriceInterval +Billing interval (e.g. 'month', 'year'). + ## Values diff --git a/others/python-sdk/docs/models/planpriceiteminterval.md b/others/python-sdk/docs/models/planpriceiteminterval.md index 28d2bb1ff..6cab31656 100644 --- a/others/python-sdk/docs/models/planpriceiteminterval.md +++ b/others/python-sdk/docs/models/planpriceiteminterval.md @@ -1,5 +1,7 @@ # PlanPriceItemInterval +Billing interval for this price. For consumable features, should match reset.interval. + ## Values diff --git a/others/python-sdk/docs/models/planreset.md b/others/python-sdk/docs/models/planreset.md index 13eee8120..03a0310de 100644 --- a/others/python-sdk/docs/models/planreset.md +++ b/others/python-sdk/docs/models/planreset.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `interval` | [models.PlanResetInterval](../models/planresetinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `interval` | [models.PlanResetInterval](../models/planresetinterval.md) | :heavy_check_mark: | The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/planresetinterval.md b/others/python-sdk/docs/models/planresetinterval.md index 0d028f3df..0612c99bc 100644 --- a/others/python-sdk/docs/models/planresetinterval.md +++ b/others/python-sdk/docs/models/planresetinterval.md @@ -1,5 +1,7 @@ # PlanResetInterval +The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + ## Values diff --git a/others/python-sdk/docs/models/planrollover.md b/others/python-sdk/docs/models/planrollover.md index 61e6fbec4..b24a347af 100644 --- a/others/python-sdk/docs/models/planrollover.md +++ b/others/python-sdk/docs/models/planrollover.md @@ -1,10 +1,12 @@ # PlanRollover +Rollover configuration for unused units. If set, unused included units roll over to the next period. + ## Fields | Field | Type | Required | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `max` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `expiry_duration_type` | [models.ExpiryDurationType](../models/expirydurationtype.md) | :heavy_check_mark: | N/A | -| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `max` | *Nullable[float]* | :heavy_check_mark: | Maximum rollover units. Null for unlimited rollover. | +| `expiry_duration_type` | [models.ExpiryDurationType](../models/expirydurationtype.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/preview.md b/others/python-sdk/docs/models/preview.md index f1c2dbfbe..30f2fde54 100644 --- a/others/python-sdk/docs/models/preview.md +++ b/others/python-sdk/docs/models/preview.md @@ -7,7 +7,7 @@ Upgrade/upsell information when access is denied. Only present if with_preview w | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `scenario` | [models.CheckScenario](../models/checkscenario.md) | :heavy_check_mark: | The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. | +| `scenario` | [models.Scenario](../models/scenario.md) | :heavy_check_mark: | The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. | | `title` | *str* | :heavy_check_mark: | A title suitable for displaying in a paywall or upgrade modal. | | `message` | *str* | :heavy_check_mark: | A message explaining why access was denied. | | `feature_id` | *str* | :heavy_check_mark: | The ID of the feature that was checked. | diff --git a/others/python-sdk/docs/models/previewattachbillingmethod.md b/others/python-sdk/docs/models/previewattachbillingmethod.md index c7a69be0d..1646686d9 100644 --- a/others/python-sdk/docs/models/previewattachbillingmethod.md +++ b/others/python-sdk/docs/models/previewattachbillingmethod.md @@ -1,5 +1,7 @@ # PreviewAttachBillingMethod +'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + ## Values diff --git a/others/python-sdk/docs/models/previewattachdurationtype.md b/others/python-sdk/docs/models/previewattachdurationtype.md index a995bff9f..e9584b37e 100644 --- a/others/python-sdk/docs/models/previewattachdurationtype.md +++ b/others/python-sdk/docs/models/previewattachdurationtype.md @@ -1,5 +1,7 @@ # PreviewAttachDurationType +Unit of time for the trial ('day', 'month', 'year'). + ## Values diff --git a/others/python-sdk/docs/models/previewattachexpirydurationtype.md b/others/python-sdk/docs/models/previewattachexpirydurationtype.md index dcc75b098..1ab76bb0e 100644 --- a/others/python-sdk/docs/models/previewattachexpirydurationtype.md +++ b/others/python-sdk/docs/models/previewattachexpirydurationtype.md @@ -1,5 +1,7 @@ # PreviewAttachExpiryDurationType +When rolled over units expire. + ## Values diff --git a/others/python-sdk/docs/models/previewattachfreetrial.md b/others/python-sdk/docs/models/previewattachfreetrial.md index 54d2be4ee..477a16448 100644 --- a/others/python-sdk/docs/models/previewattachfreetrial.md +++ b/others/python-sdk/docs/models/previewattachfreetrial.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `duration_length` | *float* | :heavy_check_mark: | N/A | -| `duration_type` | [Optional[models.PreviewAttachDurationType]](../models/previewattachdurationtype.md) | :heavy_minus_sign: | N/A | -| `card_required` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `duration_length` | *float* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `duration_type` | [Optional[models.PreviewAttachDurationType]](../models/previewattachdurationtype.md) | :heavy_minus_sign: | Unit of time for the trial ('day', 'month', 'year'). | +| `card_required` | *Optional[bool]* | :heavy_minus_sign: | If true, payment method required to start trial. Customer is charged after trial ends. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachitem.md b/others/python-sdk/docs/models/previewattachitem.md index ced5afb0b..e172ba71a 100644 --- a/others/python-sdk/docs/models/previewattachitem.md +++ b/others/python-sdk/docs/models/previewattachitem.md @@ -3,12 +3,12 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `included` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `reset` | [Optional[models.PreviewAttachReset]](../models/previewattachreset.md) | :heavy_minus_sign: | N/A | -| `price` | [Optional[models.PreviewAttachItemPrice]](../models/previewattachitemprice.md) | :heavy_minus_sign: | N/A | -| `proration` | [Optional[models.PreviewAttachProration]](../models/previewattachproration.md) | :heavy_minus_sign: | N/A | -| `rollover` | [Optional[models.PreviewAttachRollover]](../models/previewattachrollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature to configure. | +| `included` | *Optional[float]* | :heavy_minus_sign: | Number of free units included. Balance resets to this each interval for consumable features. | +| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | If true, customer has unlimited access to this feature. | +| `reset` | [Optional[models.PreviewAttachReset]](../models/previewattachreset.md) | :heavy_minus_sign: | Reset configuration for consumable features. Omit for non-consumable features like seats. | +| `price` | [Optional[models.PreviewAttachItemPrice]](../models/previewattachitemprice.md) | :heavy_minus_sign: | Pricing for usage beyond included units. Omit for free features. | +| `proration` | [Optional[models.PreviewAttachProration]](../models/previewattachproration.md) | :heavy_minus_sign: | Proration settings for prepaid features. Controls mid-cycle quantity change billing. | +| `rollover` | [Optional[models.PreviewAttachRollover]](../models/previewattachrollover.md) | :heavy_minus_sign: | Rollover config for unused units. If set, unused included units carry over. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachitemprice.md b/others/python-sdk/docs/models/previewattachitemprice.md index 09404c66b..8eea11a0d 100644 --- a/others/python-sdk/docs/models/previewattachitemprice.md +++ b/others/python-sdk/docs/models/previewattachitemprice.md @@ -1,14 +1,16 @@ # PreviewAttachItemPrice +Pricing for usage beyond included units. Omit for free features. + ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.PreviewAttachTier](../models/previewattachtier.md)] | :heavy_minus_sign: | N/A | -| `interval` | [models.PreviewAttachItemPriceInterval](../models/previewattachitempriceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `billing_units` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `billing_method` | [models.PreviewAttachBillingMethod](../models/previewattachbillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `amount` | *Optional[float]* | :heavy_minus_sign: | Price per billing_units after included usage. Either 'amount' or 'tiers' is required. | +| `tiers` | List[[models.PreviewAttachTier](../models/previewattachtier.md)] | :heavy_minus_sign: | Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. | +| `interval` | [models.PreviewAttachItemPriceInterval](../models/previewattachitempriceinterval.md) | :heavy_check_mark: | Billing interval. For consumable features, should match reset.interval. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billing_units` | *Optional[float]* | :heavy_minus_sign: | Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). | +| `billing_method` | [models.PreviewAttachBillingMethod](../models/previewattachbillingmethod.md) | :heavy_check_mark: | 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. | +| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachitempriceinterval.md b/others/python-sdk/docs/models/previewattachitempriceinterval.md index b258bbbcb..7ebceccac 100644 --- a/others/python-sdk/docs/models/previewattachitempriceinterval.md +++ b/others/python-sdk/docs/models/previewattachitempriceinterval.md @@ -1,5 +1,7 @@ # PreviewAttachItemPriceInterval +Billing interval. For consumable features, should match reset.interval. + ## Values diff --git a/others/python-sdk/docs/models/previewattachondecrease.md b/others/python-sdk/docs/models/previewattachondecrease.md index e092b88fd..6d8552af7 100644 --- a/others/python-sdk/docs/models/previewattachondecrease.md +++ b/others/python-sdk/docs/models/previewattachondecrease.md @@ -1,5 +1,7 @@ # PreviewAttachOnDecrease +Credit behavior when quantity decreases mid-cycle. + ## Values diff --git a/others/python-sdk/docs/models/previewattachonincrease.md b/others/python-sdk/docs/models/previewattachonincrease.md index eb0441c2d..2fe65b7ad 100644 --- a/others/python-sdk/docs/models/previewattachonincrease.md +++ b/others/python-sdk/docs/models/previewattachonincrease.md @@ -1,5 +1,7 @@ # PreviewAttachOnIncrease +Billing behavior when quantity increases mid-cycle. + ## Values diff --git a/others/python-sdk/docs/models/previewattachprice.md b/others/python-sdk/docs/models/previewattachprice.md index ccc415e76..1f92cf427 100644 --- a/others/python-sdk/docs/models/previewattachprice.md +++ b/others/python-sdk/docs/models/previewattachprice.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `amount` | *float* | :heavy_check_mark: | N/A | -| `interval` | [models.PreviewAttachPriceInterval](../models/previewattachpriceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `amount` | *float* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.PreviewAttachPriceInterval](../models/previewattachpriceinterval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachpriceinterval.md b/others/python-sdk/docs/models/previewattachpriceinterval.md index 9d9ee86de..052b4f55f 100644 --- a/others/python-sdk/docs/models/previewattachpriceinterval.md +++ b/others/python-sdk/docs/models/previewattachpriceinterval.md @@ -1,5 +1,7 @@ # PreviewAttachPriceInterval +Billing interval (e.g. 'month', 'year'). + ## Values diff --git a/others/python-sdk/docs/models/previewattachproration.md b/others/python-sdk/docs/models/previewattachproration.md index f7f7fb38b..86fef8897 100644 --- a/others/python-sdk/docs/models/previewattachproration.md +++ b/others/python-sdk/docs/models/previewattachproration.md @@ -1,9 +1,11 @@ # PreviewAttachProration +Proration settings for prepaid features. Controls mid-cycle quantity change billing. + ## Fields | Field | Type | Required | Description | | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `on_increase` | [models.PreviewAttachOnIncrease](../models/previewattachonincrease.md) | :heavy_check_mark: | N/A | -| `on_decrease` | [models.PreviewAttachOnDecrease](../models/previewattachondecrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| `on_increase` | [models.PreviewAttachOnIncrease](../models/previewattachonincrease.md) | :heavy_check_mark: | Billing behavior when quantity increases mid-cycle. | +| `on_decrease` | [models.PreviewAttachOnDecrease](../models/previewattachondecrease.md) | :heavy_check_mark: | Credit behavior when quantity decreases mid-cycle. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachreset.md b/others/python-sdk/docs/models/previewattachreset.md index 2d89267d6..9f0dbd399 100644 --- a/others/python-sdk/docs/models/previewattachreset.md +++ b/others/python-sdk/docs/models/previewattachreset.md @@ -1,9 +1,11 @@ # PreviewAttachReset +Reset configuration for consumable features. Omit for non-consumable features like seats. + ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `interval` | [models.PreviewAttachResetInterval](../models/previewattachresetinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `interval` | [models.PreviewAttachResetInterval](../models/previewattachresetinterval.md) | :heavy_check_mark: | Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachresetinterval.md b/others/python-sdk/docs/models/previewattachresetinterval.md index 85e80bbd0..3e9b1be35 100644 --- a/others/python-sdk/docs/models/previewattachresetinterval.md +++ b/others/python-sdk/docs/models/previewattachresetinterval.md @@ -1,5 +1,7 @@ # PreviewAttachResetInterval +Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + ## Values diff --git a/others/python-sdk/docs/models/previewattachrollover.md b/others/python-sdk/docs/models/previewattachrollover.md index 35b9addf8..cdde9832c 100644 --- a/others/python-sdk/docs/models/previewattachrollover.md +++ b/others/python-sdk/docs/models/previewattachrollover.md @@ -1,10 +1,12 @@ # PreviewAttachRollover +Rollover config for unused units. If set, unused included units carry over. + ## Fields | Field | Type | Required | Description | | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `max` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `expiry_duration_type` | [models.PreviewAttachExpiryDurationType](../models/previewattachexpirydurationtype.md) | :heavy_check_mark: | N/A | -| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `max` | *Optional[float]* | :heavy_minus_sign: | Max rollover units. Omit for unlimited rollover. | +| `expiry_duration_type` | [models.PreviewAttachExpiryDurationType](../models/previewattachexpirydurationtype.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdatebillingmethod.md b/others/python-sdk/docs/models/previewupdatebillingmethod.md index 07e5a9ad4..c8f89cb2d 100644 --- a/others/python-sdk/docs/models/previewupdatebillingmethod.md +++ b/others/python-sdk/docs/models/previewupdatebillingmethod.md @@ -1,5 +1,7 @@ # PreviewUpdateBillingMethod +'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + ## Values diff --git a/others/python-sdk/docs/models/previewupdatedurationtype.md b/others/python-sdk/docs/models/previewupdatedurationtype.md index 260c788c7..8a52c0c6c 100644 --- a/others/python-sdk/docs/models/previewupdatedurationtype.md +++ b/others/python-sdk/docs/models/previewupdatedurationtype.md @@ -1,5 +1,7 @@ # PreviewUpdateDurationType +Unit of time for the trial ('day', 'month', 'year'). + ## Values diff --git a/others/python-sdk/docs/models/previewupdateexpirydurationtype.md b/others/python-sdk/docs/models/previewupdateexpirydurationtype.md index f48ebd5a7..dd5866b25 100644 --- a/others/python-sdk/docs/models/previewupdateexpirydurationtype.md +++ b/others/python-sdk/docs/models/previewupdateexpirydurationtype.md @@ -1,5 +1,7 @@ # PreviewUpdateExpiryDurationType +When rolled over units expire. + ## Values diff --git a/others/python-sdk/docs/models/previewupdatefreetrial.md b/others/python-sdk/docs/models/previewupdatefreetrial.md index 195d54bc5..6460e34c3 100644 --- a/others/python-sdk/docs/models/previewupdatefreetrial.md +++ b/others/python-sdk/docs/models/previewupdatefreetrial.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `duration_length` | *float* | :heavy_check_mark: | N/A | -| `duration_type` | [Optional[models.PreviewUpdateDurationType]](../models/previewupdatedurationtype.md) | :heavy_minus_sign: | N/A | -| `card_required` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `duration_length` | *float* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `duration_type` | [Optional[models.PreviewUpdateDurationType]](../models/previewupdatedurationtype.md) | :heavy_minus_sign: | Unit of time for the trial ('day', 'month', 'year'). | +| `card_required` | *Optional[bool]* | :heavy_minus_sign: | If true, payment method required to start trial. Customer is charged after trial ends. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdateitem.md b/others/python-sdk/docs/models/previewupdateitem.md index 1afdeceab..3bc6fa166 100644 --- a/others/python-sdk/docs/models/previewupdateitem.md +++ b/others/python-sdk/docs/models/previewupdateitem.md @@ -3,12 +3,12 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `included` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `reset` | [Optional[models.PreviewUpdateReset]](../models/previewupdatereset.md) | :heavy_minus_sign: | N/A | -| `price` | [Optional[models.PreviewUpdateItemPrice]](../models/previewupdateitemprice.md) | :heavy_minus_sign: | N/A | -| `proration` | [Optional[models.PreviewUpdateProration]](../models/previewupdateproration.md) | :heavy_minus_sign: | N/A | -| `rollover` | [Optional[models.PreviewUpdateRollover]](../models/previewupdaterollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature to configure. | +| `included` | *Optional[float]* | :heavy_minus_sign: | Number of free units included. Balance resets to this each interval for consumable features. | +| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | If true, customer has unlimited access to this feature. | +| `reset` | [Optional[models.PreviewUpdateReset]](../models/previewupdatereset.md) | :heavy_minus_sign: | Reset configuration for consumable features. Omit for non-consumable features like seats. | +| `price` | [Optional[models.PreviewUpdateItemPrice]](../models/previewupdateitemprice.md) | :heavy_minus_sign: | Pricing for usage beyond included units. Omit for free features. | +| `proration` | [Optional[models.PreviewUpdateProration]](../models/previewupdateproration.md) | :heavy_minus_sign: | Proration settings for prepaid features. Controls mid-cycle quantity change billing. | +| `rollover` | [Optional[models.PreviewUpdateRollover]](../models/previewupdaterollover.md) | :heavy_minus_sign: | Rollover config for unused units. If set, unused included units carry over. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdateitemprice.md b/others/python-sdk/docs/models/previewupdateitemprice.md index f699b1b9c..5542db823 100644 --- a/others/python-sdk/docs/models/previewupdateitemprice.md +++ b/others/python-sdk/docs/models/previewupdateitemprice.md @@ -1,14 +1,16 @@ # PreviewUpdateItemPrice +Pricing for usage beyond included units. Omit for free features. + ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.PreviewUpdateTier](../models/previewupdatetier.md)] | :heavy_minus_sign: | N/A | -| `interval` | [models.PreviewUpdateItemPriceInterval](../models/previewupdateitempriceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `billing_units` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `billing_method` | [models.PreviewUpdateBillingMethod](../models/previewupdatebillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `amount` | *Optional[float]* | :heavy_minus_sign: | Price per billing_units after included usage. Either 'amount' or 'tiers' is required. | +| `tiers` | List[[models.PreviewUpdateTier](../models/previewupdatetier.md)] | :heavy_minus_sign: | Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. | +| `interval` | [models.PreviewUpdateItemPriceInterval](../models/previewupdateitempriceinterval.md) | :heavy_check_mark: | Billing interval. For consumable features, should match reset.interval. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billing_units` | *Optional[float]* | :heavy_minus_sign: | Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). | +| `billing_method` | [models.PreviewUpdateBillingMethod](../models/previewupdatebillingmethod.md) | :heavy_check_mark: | 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. | +| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdateitempriceinterval.md b/others/python-sdk/docs/models/previewupdateitempriceinterval.md index de9ace7df..4d03b6784 100644 --- a/others/python-sdk/docs/models/previewupdateitempriceinterval.md +++ b/others/python-sdk/docs/models/previewupdateitempriceinterval.md @@ -1,5 +1,7 @@ # PreviewUpdateItemPriceInterval +Billing interval. For consumable features, should match reset.interval. + ## Values diff --git a/others/python-sdk/docs/models/previewupdateondecrease.md b/others/python-sdk/docs/models/previewupdateondecrease.md index 418b15cfe..1ca348c8d 100644 --- a/others/python-sdk/docs/models/previewupdateondecrease.md +++ b/others/python-sdk/docs/models/previewupdateondecrease.md @@ -1,5 +1,7 @@ # PreviewUpdateOnDecrease +Credit behavior when quantity decreases mid-cycle. + ## Values diff --git a/others/python-sdk/docs/models/previewupdateonincrease.md b/others/python-sdk/docs/models/previewupdateonincrease.md index e3e53e3b7..a36f192fc 100644 --- a/others/python-sdk/docs/models/previewupdateonincrease.md +++ b/others/python-sdk/docs/models/previewupdateonincrease.md @@ -1,5 +1,7 @@ # PreviewUpdateOnIncrease +Billing behavior when quantity increases mid-cycle. + ## Values diff --git a/others/python-sdk/docs/models/previewupdateprice.md b/others/python-sdk/docs/models/previewupdateprice.md index a0c8b350a..a2db72e18 100644 --- a/others/python-sdk/docs/models/previewupdateprice.md +++ b/others/python-sdk/docs/models/previewupdateprice.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `amount` | *float* | :heavy_check_mark: | N/A | -| `interval` | [models.PreviewUpdatePriceInterval](../models/previewupdatepriceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `amount` | *float* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.PreviewUpdatePriceInterval](../models/previewupdatepriceinterval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdatepriceinterval.md b/others/python-sdk/docs/models/previewupdatepriceinterval.md index 04ed4b006..14a103c8e 100644 --- a/others/python-sdk/docs/models/previewupdatepriceinterval.md +++ b/others/python-sdk/docs/models/previewupdatepriceinterval.md @@ -1,5 +1,7 @@ # PreviewUpdatePriceInterval +Billing interval (e.g. 'month', 'year'). + ## Values diff --git a/others/python-sdk/docs/models/previewupdateproration.md b/others/python-sdk/docs/models/previewupdateproration.md index 36d19f6f8..2dcc8bc0d 100644 --- a/others/python-sdk/docs/models/previewupdateproration.md +++ b/others/python-sdk/docs/models/previewupdateproration.md @@ -1,9 +1,11 @@ # PreviewUpdateProration +Proration settings for prepaid features. Controls mid-cycle quantity change billing. + ## Fields | Field | Type | Required | Description | | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `on_increase` | [models.PreviewUpdateOnIncrease](../models/previewupdateonincrease.md) | :heavy_check_mark: | N/A | -| `on_decrease` | [models.PreviewUpdateOnDecrease](../models/previewupdateondecrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| `on_increase` | [models.PreviewUpdateOnIncrease](../models/previewupdateonincrease.md) | :heavy_check_mark: | Billing behavior when quantity increases mid-cycle. | +| `on_decrease` | [models.PreviewUpdateOnDecrease](../models/previewupdateondecrease.md) | :heavy_check_mark: | Credit behavior when quantity decreases mid-cycle. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdatereset.md b/others/python-sdk/docs/models/previewupdatereset.md index c77a0bf23..c85d5a330 100644 --- a/others/python-sdk/docs/models/previewupdatereset.md +++ b/others/python-sdk/docs/models/previewupdatereset.md @@ -1,9 +1,11 @@ # PreviewUpdateReset +Reset configuration for consumable features. Omit for non-consumable features like seats. + ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `interval` | [models.PreviewUpdateResetInterval](../models/previewupdateresetinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `interval` | [models.PreviewUpdateResetInterval](../models/previewupdateresetinterval.md) | :heavy_check_mark: | Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdateresetinterval.md b/others/python-sdk/docs/models/previewupdateresetinterval.md index 3aaf15ff0..8290e0f1a 100644 --- a/others/python-sdk/docs/models/previewupdateresetinterval.md +++ b/others/python-sdk/docs/models/previewupdateresetinterval.md @@ -1,5 +1,7 @@ # PreviewUpdateResetInterval +Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + ## Values diff --git a/others/python-sdk/docs/models/previewupdaterollover.md b/others/python-sdk/docs/models/previewupdaterollover.md index 2972f7cd1..1487f97cf 100644 --- a/others/python-sdk/docs/models/previewupdaterollover.md +++ b/others/python-sdk/docs/models/previewupdaterollover.md @@ -1,10 +1,12 @@ # PreviewUpdateRollover +Rollover config for unused units. If set, unused included units carry over. + ## Fields | Field | Type | Required | Description | | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `max` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `expiry_duration_type` | [models.PreviewUpdateExpiryDurationType](../models/previewupdateexpirydurationtype.md) | :heavy_check_mark: | N/A | -| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `max` | *Optional[float]* | :heavy_minus_sign: | Max rollover units. Omit for unlimited rollover. | +| `expiry_duration_type` | [models.PreviewUpdateExpiryDurationType](../models/previewupdateexpirydurationtype.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/proration.md b/others/python-sdk/docs/models/proration.md deleted file mode 100644 index aebfc4cbf..000000000 --- a/others/python-sdk/docs/models/proration.md +++ /dev/null @@ -1,9 +0,0 @@ -# Proration - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | -| `on_increase` | [Optional[models.OnIncrease]](../models/onincrease.md) | :heavy_minus_sign: | N/A | -| `on_decrease` | [Optional[models.OnDecrease]](../models/ondecrease.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/scenario.md b/others/python-sdk/docs/models/scenario.md index c89b05ac9..58c924cba 100644 --- a/others/python-sdk/docs/models/scenario.md +++ b/others/python-sdk/docs/models/scenario.md @@ -1,16 +1,11 @@ # Scenario +The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. + ## Values -| Name | Value | -| ----------- | ----------- | -| `SCHEDULED` | scheduled | -| `ACTIVE` | active | -| `NEW` | new | -| `RENEW` | renew | -| `UPGRADE` | upgrade | -| `DOWNGRADE` | downgrade | -| `CANCEL` | cancel | -| `EXPIRED` | expired | -| `PAST_DUE` | past_due | \ No newline at end of file +| Name | Value | +| -------------- | -------------- | +| `USAGE_LIMIT` | usage_limit | +| `FEATURE_FLAG` | feature_flag | \ No newline at end of file diff --git a/others/python-sdk/docs/models/setuppaymentglobals.md b/others/python-sdk/docs/models/setuppaymentglobals.md new file mode 100644 index 000000000..e46150aa6 --- /dev/null +++ b/others/python-sdk/docs/models/setuppaymentglobals.md @@ -0,0 +1,8 @@ +# SetupPaymentGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/setuppaymentparams.md b/others/python-sdk/docs/models/setuppaymentparams.md new file mode 100644 index 000000000..a2ab141be --- /dev/null +++ b/others/python-sdk/docs/models/setuppaymentparams.md @@ -0,0 +1,11 @@ +# SetupPaymentParams + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer | +| `success_url` | *Optional[str]* | :heavy_minus_sign: | URL to redirect to after successful payment setup. Must start with either http:// or https:// | +| `customer_data` | [Optional[models.CustomerData]](../models/customerdata.md) | :heavy_minus_sign: | Customer details to set when creating a customer | +| `checkout_session_params` | Dict[str, *Any*] | :heavy_minus_sign: | Additional parameters for the checkout session | \ No newline at end of file diff --git a/others/python-sdk/docs/models/setuppaymentresponse.md b/others/python-sdk/docs/models/setuppaymentresponse.md new file mode 100644 index 000000000..06ac684aa --- /dev/null +++ b/others/python-sdk/docs/models/setuppaymentresponse.md @@ -0,0 +1,11 @@ +# SetupPaymentResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer | +| `url` | *str* | :heavy_check_mark: | URL to the payment setup page | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanbillingmethodrequest.md b/others/python-sdk/docs/models/updateplanbillingmethodrequest.md new file mode 100644 index 000000000..a59277cc1 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanbillingmethodrequest.md @@ -0,0 +1,11 @@ +# UpdatePlanBillingMethodRequest + +'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `PREPAID` | prepaid | +| `USAGE_BASED` | usage_based | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanbillingmethodresponse.md b/others/python-sdk/docs/models/updateplanbillingmethodresponse.md new file mode 100644 index 000000000..336643d69 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanbillingmethodresponse.md @@ -0,0 +1,11 @@ +# UpdatePlanBillingMethodResponse + +'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `PREPAID` | prepaid | +| `USAGE_BASED` | usage_based | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplancreditschema.md b/others/python-sdk/docs/models/updateplancreditschema.md new file mode 100644 index 000000000..b435b3f93 --- /dev/null +++ b/others/python-sdk/docs/models/updateplancreditschema.md @@ -0,0 +1,9 @@ +# UpdatePlanCreditSchema + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `metered_feature_id` | *str* | :heavy_check_mark: | The ID of the metered feature (should be a single_use feature). | +| `credit_cost` | *float* | :heavy_check_mark: | The credit cost of the metered feature. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplandurationtyperequest.md b/others/python-sdk/docs/models/updateplandurationtyperequest.md new file mode 100644 index 000000000..a5e74c271 --- /dev/null +++ b/others/python-sdk/docs/models/updateplandurationtyperequest.md @@ -0,0 +1,12 @@ +# UpdatePlanDurationTypeRequest + +Unit of time for the trial ('day', 'month', 'year'). + + +## Values + +| Name | Value | +| ------- | ------- | +| `DAY` | day | +| `MONTH` | month | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplandurationtyperesponse.md b/others/python-sdk/docs/models/updateplandurationtyperesponse.md new file mode 100644 index 000000000..a6655d3f8 --- /dev/null +++ b/others/python-sdk/docs/models/updateplandurationtyperesponse.md @@ -0,0 +1,12 @@ +# UpdatePlanDurationTypeResponse + +Unit of time for the trial duration ('day', 'month', 'year'). + + +## Values + +| Name | Value | +| ------- | ------- | +| `DAY` | day | +| `MONTH` | month | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanenv.md b/others/python-sdk/docs/models/updateplanenv.md new file mode 100644 index 000000000..4d2737b1c --- /dev/null +++ b/others/python-sdk/docs/models/updateplanenv.md @@ -0,0 +1,11 @@ +# UpdatePlanEnv + +Environment this plan belongs to ('sandbox' or 'live'). + + +## Values + +| Name | Value | +| --------- | --------- | +| `SANDBOX` | sandbox | +| `LIVE` | live | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanexpirydurationtyperequest.md b/others/python-sdk/docs/models/updateplanexpirydurationtyperequest.md new file mode 100644 index 000000000..4cb0c3b03 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanexpirydurationtyperequest.md @@ -0,0 +1,11 @@ +# UpdatePlanExpiryDurationTypeRequest + +When rolled over units expire. + + +## Values + +| Name | Value | +| --------- | --------- | +| `MONTH` | month | +| `FOREVER` | forever | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanexpirydurationtyperesponse.md b/others/python-sdk/docs/models/updateplanexpirydurationtyperesponse.md new file mode 100644 index 000000000..0d56ea783 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanexpirydurationtyperesponse.md @@ -0,0 +1,11 @@ +# UpdatePlanExpiryDurationTypeResponse + +When rolled over units expire. + + +## Values + +| Name | Value | +| --------- | --------- | +| `MONTH` | month | +| `FOREVER` | forever | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanfeature.md b/others/python-sdk/docs/models/updateplanfeature.md new file mode 100644 index 000000000..feb3bd82d --- /dev/null +++ b/others/python-sdk/docs/models/updateplanfeature.md @@ -0,0 +1,15 @@ +# UpdatePlanFeature + +The full feature object if expanded. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `id` | *str* | :heavy_check_mark: | The ID of the feature, used to refer to it in other API calls like /track or /check. | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the feature. | +| `type` | [models.UpdatePlanType](../models/updateplantype.md) | :heavy_check_mark: | The type of the feature | +| `display` | [OptionalNullable[models.UpdatePlanFeatureDisplay]](../models/updateplanfeaturedisplay.md) | :heavy_minus_sign: | Singular and plural display names for the feature. | +| `credit_schema` | List[[models.UpdatePlanCreditSchema](../models/updateplancreditschema.md)] | :heavy_minus_sign: | Credit cost schema for credit system features. | +| `archived` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether or not the feature is archived. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanfeaturedisplay.md b/others/python-sdk/docs/models/updateplanfeaturedisplay.md new file mode 100644 index 000000000..02d1005d8 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanfeaturedisplay.md @@ -0,0 +1,9 @@ +# UpdatePlanFeatureDisplay + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `singular` | *str* | :heavy_check_mark: | The singular display name for the feature. | +| `plural` | *str* | :heavy_check_mark: | The plural display name for the feature. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanfreetrialrequest.md b/others/python-sdk/docs/models/updateplanfreetrialrequest.md new file mode 100644 index 000000000..11d00bd8a --- /dev/null +++ b/others/python-sdk/docs/models/updateplanfreetrialrequest.md @@ -0,0 +1,10 @@ +# UpdatePlanFreeTrialRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `duration_length` | *float* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `duration_type` | [Optional[models.UpdatePlanDurationTypeRequest]](../models/updateplandurationtyperequest.md) | :heavy_minus_sign: | Unit of time for the trial ('day', 'month', 'year'). | +| `card_required` | *Optional[bool]* | :heavy_minus_sign: | If true, payment method required to start trial. Customer is charged after trial ends. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanfreetrialresponse.md b/others/python-sdk/docs/models/updateplanfreetrialresponse.md new file mode 100644 index 000000000..f834a7680 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanfreetrialresponse.md @@ -0,0 +1,12 @@ +# UpdatePlanFreeTrialResponse + +Free trial configuration. If set, new customers can try this plan before being charged. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `duration_length` | *float* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `duration_type` | [models.UpdatePlanDurationTypeResponse](../models/updateplandurationtyperesponse.md) | :heavy_check_mark: | Unit of time for the trial duration ('day', 'month', 'year'). | +| `card_required` | *bool* | :heavy_check_mark: | Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanglobals.md b/others/python-sdk/docs/models/updateplanglobals.md new file mode 100644 index 000000000..b57a24f33 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanglobals.md @@ -0,0 +1,8 @@ +# UpdatePlanGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanitemdisplay.md b/others/python-sdk/docs/models/updateplanitemdisplay.md new file mode 100644 index 000000000..21629fa62 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanitemdisplay.md @@ -0,0 +1,11 @@ +# UpdatePlanItemDisplay + +Display text for showing this item in pricing pages. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primary_text` | *str* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanitempriceintervalrequest.md b/others/python-sdk/docs/models/updateplanitempriceintervalrequest.md new file mode 100644 index 000000000..01a0ae3b5 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanitempriceintervalrequest.md @@ -0,0 +1,15 @@ +# UpdatePlanItemPriceIntervalRequest + +Billing interval. For consumable features, should match reset.interval. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanitempricerequest.md b/others/python-sdk/docs/models/updateplanitempricerequest.md new file mode 100644 index 000000000..a6256f2f8 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanitempricerequest.md @@ -0,0 +1,16 @@ +# UpdatePlanItemPriceRequest + +Pricing for usage beyond included units. Omit for free features. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `amount` | *Optional[float]* | :heavy_minus_sign: | Price per billing_units after included usage. Either 'amount' or 'tiers' is required. | +| `tiers` | List[[models.UpdatePlanTierRequest](../models/updateplantierrequest.md)] | :heavy_minus_sign: | Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. | +| `interval` | [models.UpdatePlanItemPriceIntervalRequest](../models/updateplanitempriceintervalrequest.md) | :heavy_check_mark: | Billing interval. For consumable features, should match reset.interval. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billing_units` | *Optional[float]* | :heavy_minus_sign: | Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). | +| `billing_method` | [models.UpdatePlanBillingMethodRequest](../models/updateplanbillingmethodrequest.md) | :heavy_check_mark: | 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. | +| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanitempriceresponse.md b/others/python-sdk/docs/models/updateplanitempriceresponse.md new file mode 100644 index 000000000..e08dbd339 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanitempriceresponse.md @@ -0,0 +1,14 @@ +# UpdatePlanItemPriceResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[float]* | :heavy_minus_sign: | Price per billing_units after included usage is consumed. Mutually exclusive with tiers. | +| `tiers` | List[[models.UpdatePlanTierResponse](../models/updateplantierresponse.md)] | :heavy_minus_sign: | Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. | +| `interval` | [models.UpdatePlanPriceItemIntervalResponse](../models/updateplanpriceitemintervalresponse.md) | :heavy_check_mark: | Billing interval for this price. For consumable features, should match reset.interval. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billing_units` | *float* | :heavy_check_mark: | Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). | +| `billing_method` | [models.UpdatePlanBillingMethodResponse](../models/updateplanbillingmethodresponse.md) | :heavy_check_mark: | 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. | +| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanitemrequest.md b/others/python-sdk/docs/models/updateplanitemrequest.md new file mode 100644 index 000000000..27d807add --- /dev/null +++ b/others/python-sdk/docs/models/updateplanitemrequest.md @@ -0,0 +1,14 @@ +# UpdatePlanItemRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature to configure. | +| `included` | *Optional[float]* | :heavy_minus_sign: | Number of free units included. Balance resets to this each interval for consumable features. | +| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | If true, customer has unlimited access to this feature. | +| `reset` | [Optional[models.UpdatePlanResetRequest]](../models/updateplanresetrequest.md) | :heavy_minus_sign: | Reset configuration for consumable features. Omit for non-consumable features like seats. | +| `price` | [Optional[models.UpdatePlanItemPriceRequest]](../models/updateplanitempricerequest.md) | :heavy_minus_sign: | Pricing for usage beyond included units. Omit for free features. | +| `proration` | [Optional[models.UpdatePlanProration]](../models/updateplanproration.md) | :heavy_minus_sign: | Proration settings for prepaid features. Controls mid-cycle quantity change billing. | +| `rollover` | [Optional[models.UpdatePlanRolloverRequest]](../models/updateplanrolloverrequest.md) | :heavy_minus_sign: | Rollover config for unused units. If set, unused included units carry over. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanitemresponse.md b/others/python-sdk/docs/models/updateplanitemresponse.md new file mode 100644 index 000000000..816928fef --- /dev/null +++ b/others/python-sdk/docs/models/updateplanitemresponse.md @@ -0,0 +1,15 @@ +# UpdatePlanItemResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature this item configures. | +| `feature` | [Optional[models.UpdatePlanFeature]](../models/updateplanfeature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `included` | *float* | :heavy_check_mark: | Number of free units included. For consumable features, balance resets to this number each interval. | +| `unlimited` | *bool* | :heavy_check_mark: | Whether the customer has unlimited access to this feature. | +| `reset` | [Nullable[models.UpdatePlanResetResponse]](../models/updateplanresetresponse.md) | :heavy_check_mark: | Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. | +| `price` | [Nullable[models.UpdatePlanItemPriceResponse]](../models/updateplanitempriceresponse.md) | :heavy_check_mark: | Pricing configuration for usage beyond included units. Null if feature is entirely free. | +| `display` | [Optional[models.UpdatePlanItemDisplay]](../models/updateplanitemdisplay.md) | :heavy_minus_sign: | Display text for showing this item in pricing pages. | +| `rollover` | [Optional[models.UpdatePlanRolloverResponse]](../models/updateplanrolloverresponse.md) | :heavy_minus_sign: | Rollover configuration for unused units. If set, unused included units roll over to the next period. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanondecrease.md b/others/python-sdk/docs/models/updateplanondecrease.md new file mode 100644 index 000000000..d21cecf98 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanondecrease.md @@ -0,0 +1,14 @@ +# UpdatePlanOnDecrease + +Credit behavior when quantity decreases mid-cycle. + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `PRORATE` | prorate | +| `PRORATE_IMMEDIATELY` | prorate_immediately | +| `PRORATE_NEXT_CYCLE` | prorate_next_cycle | +| `NONE` | none | +| `NO_PRORATIONS` | no_prorations | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanonincrease.md b/others/python-sdk/docs/models/updateplanonincrease.md new file mode 100644 index 000000000..04577435b --- /dev/null +++ b/others/python-sdk/docs/models/updateplanonincrease.md @@ -0,0 +1,13 @@ +# UpdatePlanOnIncrease + +Billing behavior when quantity increases mid-cycle. + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `BILL_IMMEDIATELY` | bill_immediately | +| `PRORATE_IMMEDIATELY` | prorate_immediately | +| `PRORATE_NEXT_CYCLE` | prorate_next_cycle | +| `BILL_NEXT_CYCLE` | bill_next_cycle | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanparams.md b/others/python-sdk/docs/models/updateplanparams.md new file mode 100644 index 000000000..40a0438a6 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanparams.md @@ -0,0 +1,19 @@ +# UpdatePlanParams + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan to update. | +| `group` | *Optional[str]* | :heavy_minus_sign: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `name` | *Optional[str]* | :heavy_minus_sign: | Display name of the plan. | +| `description` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `add_on` | *Optional[bool]* | :heavy_minus_sign: | Whether the plan is an add-on. | +| `auto_enable` | *Optional[bool]* | :heavy_minus_sign: | Whether the plan is automatically enabled. | +| `price` | [OptionalNullable[models.UpdatePlanPriceRequest]](../models/updateplanpricerequest.md) | :heavy_minus_sign: | The price of the plan. Set to null to remove the base price. | +| `items` | List[[models.UpdatePlanItemRequest](../models/updateplanitemrequest.md)] | :heavy_minus_sign: | Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. | +| `free_trial` | [OptionalNullable[models.UpdatePlanFreeTrialRequest]](../models/updateplanfreetrialrequest.md) | :heavy_minus_sign: | The free trial of the plan. Set to null to remove the free trial. | +| `version` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `archived` | *Optional[bool]* | :heavy_minus_sign: | N/A | +| `new_plan_id` | *Optional[str]* | :heavy_minus_sign: | The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanpricedisplay.md b/others/python-sdk/docs/models/updateplanpricedisplay.md new file mode 100644 index 000000000..acb2e9091 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanpricedisplay.md @@ -0,0 +1,11 @@ +# UpdatePlanPriceDisplay + +Display text for showing this price in pricing pages. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primary_text` | *str* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanpriceintervalrequest.md b/others/python-sdk/docs/models/updateplanpriceintervalrequest.md new file mode 100644 index 000000000..243d5c062 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanpriceintervalrequest.md @@ -0,0 +1,15 @@ +# UpdatePlanPriceIntervalRequest + +Billing interval (e.g. 'month', 'year'). + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanpriceintervalresponse.md b/others/python-sdk/docs/models/updateplanpriceintervalresponse.md new file mode 100644 index 000000000..74b3b32e7 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanpriceintervalresponse.md @@ -0,0 +1,15 @@ +# UpdatePlanPriceIntervalResponse + +Billing interval (e.g. 'month', 'year'). + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanpriceitemintervalresponse.md b/others/python-sdk/docs/models/updateplanpriceitemintervalresponse.md new file mode 100644 index 000000000..97de36201 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanpriceitemintervalresponse.md @@ -0,0 +1,15 @@ +# UpdatePlanPriceItemIntervalResponse + +Billing interval for this price. For consumable features, should match reset.interval. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanpricerequest.md b/others/python-sdk/docs/models/updateplanpricerequest.md new file mode 100644 index 000000000..621bc0d5d --- /dev/null +++ b/others/python-sdk/docs/models/updateplanpricerequest.md @@ -0,0 +1,10 @@ +# UpdatePlanPriceRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `amount` | *float* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.UpdatePlanPriceIntervalRequest](../models/updateplanpriceintervalrequest.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanpriceresponse.md b/others/python-sdk/docs/models/updateplanpriceresponse.md new file mode 100644 index 000000000..ff7cecb00 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanpriceresponse.md @@ -0,0 +1,11 @@ +# UpdatePlanPriceResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `amount` | *float* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.UpdatePlanPriceIntervalResponse](../models/updateplanpriceintervalresponse.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `display` | [Optional[models.UpdatePlanPriceDisplay]](../models/updateplanpricedisplay.md) | :heavy_minus_sign: | Display text for showing this price in pricing pages. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanproration.md b/others/python-sdk/docs/models/updateplanproration.md new file mode 100644 index 000000000..2d494ae9f --- /dev/null +++ b/others/python-sdk/docs/models/updateplanproration.md @@ -0,0 +1,11 @@ +# UpdatePlanProration + +Proration settings for prepaid features. Controls mid-cycle quantity change billing. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `on_increase` | [models.UpdatePlanOnIncrease](../models/updateplanonincrease.md) | :heavy_check_mark: | Billing behavior when quantity increases mid-cycle. | +| `on_decrease` | [models.UpdatePlanOnDecrease](../models/updateplanondecrease.md) | :heavy_check_mark: | Credit behavior when quantity decreases mid-cycle. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanresetintervalrequest.md b/others/python-sdk/docs/models/updateplanresetintervalrequest.md new file mode 100644 index 000000000..da79d525d --- /dev/null +++ b/others/python-sdk/docs/models/updateplanresetintervalrequest.md @@ -0,0 +1,18 @@ +# UpdatePlanResetIntervalRequest + +Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `MINUTE` | minute | +| `HOUR` | hour | +| `DAY` | day | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanresetintervalresponse.md b/others/python-sdk/docs/models/updateplanresetintervalresponse.md new file mode 100644 index 000000000..ead7fffc1 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanresetintervalresponse.md @@ -0,0 +1,18 @@ +# UpdatePlanResetIntervalResponse + +The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `MINUTE` | minute | +| `HOUR` | hour | +| `DAY` | day | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanresetrequest.md b/others/python-sdk/docs/models/updateplanresetrequest.md new file mode 100644 index 000000000..81466e5ed --- /dev/null +++ b/others/python-sdk/docs/models/updateplanresetrequest.md @@ -0,0 +1,11 @@ +# UpdatePlanResetRequest + +Reset configuration for consumable features. Omit for non-consumable features like seats. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `interval` | [models.UpdatePlanResetIntervalRequest](../models/updateplanresetintervalrequest.md) | :heavy_check_mark: | Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanresetresponse.md b/others/python-sdk/docs/models/updateplanresetresponse.md new file mode 100644 index 000000000..2b4c66a32 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanresetresponse.md @@ -0,0 +1,9 @@ +# UpdatePlanResetResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `interval` | [models.UpdatePlanResetIntervalResponse](../models/updateplanresetintervalresponse.md) | :heavy_check_mark: | The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanresponse.md b/others/python-sdk/docs/models/updateplanresponse.md new file mode 100644 index 000000000..f6d292aa6 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanresponse.md @@ -0,0 +1,23 @@ +# UpdatePlanResponse + +A plan defines a set of features, pricing, and entitlements that can be attached to customers. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique identifier for the plan. | +| `name` | *str* | :heavy_check_mark: | Display name of the plan. | +| `description` | *Nullable[str]* | :heavy_check_mark: | Optional description of the plan. | +| `group` | *Nullable[str]* | :heavy_check_mark: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `version` | *float* | :heavy_check_mark: | Version number of the plan. Incremented when plan configuration changes. | +| `add_on` | *bool* | :heavy_check_mark: | Whether this is an add-on plan that can be attached alongside a main plan. | +| `auto_enable` | *bool* | :heavy_check_mark: | If true, this plan is automatically attached when a customer is created. Used for free plans. | +| `price` | [Nullable[models.UpdatePlanPriceResponse]](../models/updateplanpriceresponse.md) | :heavy_check_mark: | Base recurring price for the plan. Null for free plans or usage-only plans. | +| `items` | List[[models.UpdatePlanItemResponse](../models/updateplanitemresponse.md)] | :heavy_check_mark: | Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. | +| `free_trial` | [Optional[models.UpdatePlanFreeTrialResponse]](../models/updateplanfreetrialresponse.md) | :heavy_minus_sign: | Free trial configuration. If set, new customers can try this plan before being charged. | +| `created_at` | *float* | :heavy_check_mark: | Unix timestamp (ms) when the plan was created. | +| `env` | [models.UpdatePlanEnv](../models/updateplanenv.md) | :heavy_check_mark: | Environment this plan belongs to ('sandbox' or 'live'). | +| `archived` | *bool* | :heavy_check_mark: | Whether the plan is archived. Archived plans cannot be attached to new customers. | +| `base_variant_id` | *Nullable[str]* | :heavy_check_mark: | If this is a variant, the ID of the base plan it was created from. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanrolloverrequest.md b/others/python-sdk/docs/models/updateplanrolloverrequest.md new file mode 100644 index 000000000..7c6c7b7d4 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanrolloverrequest.md @@ -0,0 +1,12 @@ +# UpdatePlanRolloverRequest + +Rollover config for unused units. If set, unused included units carry over. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `max` | *Optional[float]* | :heavy_minus_sign: | Max rollover units. Omit for unlimited rollover. | +| `expiry_duration_type` | [models.UpdatePlanExpiryDurationTypeRequest](../models/updateplanexpirydurationtyperequest.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplanrolloverresponse.md b/others/python-sdk/docs/models/updateplanrolloverresponse.md new file mode 100644 index 000000000..c9c19d637 --- /dev/null +++ b/others/python-sdk/docs/models/updateplanrolloverresponse.md @@ -0,0 +1,12 @@ +# UpdatePlanRolloverResponse + +Rollover configuration for unused units. If set, unused included units roll over to the next period. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `max` | *Nullable[float]* | :heavy_check_mark: | Maximum rollover units. Null for unlimited rollover. | +| `expiry_duration_type` | [models.UpdatePlanExpiryDurationTypeResponse](../models/updateplanexpirydurationtyperesponse.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplantierrequest.md b/others/python-sdk/docs/models/updateplantierrequest.md new file mode 100644 index 000000000..e07dfc685 --- /dev/null +++ b/others/python-sdk/docs/models/updateplantierrequest.md @@ -0,0 +1,9 @@ +# UpdatePlanTierRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `to` | [models.UpdatePlanToRequest](../models/updateplantorequest.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplantierresponse.md b/others/python-sdk/docs/models/updateplantierresponse.md new file mode 100644 index 000000000..7c03b59f7 --- /dev/null +++ b/others/python-sdk/docs/models/updateplantierresponse.md @@ -0,0 +1,9 @@ +# UpdatePlanTierResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `to` | [models.UpdatePlanToResponse](../models/updateplantoresponse.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updateplantorequest.md b/others/python-sdk/docs/models/updateplantorequest.md new file mode 100644 index 000000000..dcfc0041e --- /dev/null +++ b/others/python-sdk/docs/models/updateplantorequest.md @@ -0,0 +1,17 @@ +# UpdatePlanToRequest + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/updateplantoresponse.md b/others/python-sdk/docs/models/updateplantoresponse.md new file mode 100644 index 000000000..56445be84 --- /dev/null +++ b/others/python-sdk/docs/models/updateplantoresponse.md @@ -0,0 +1,17 @@ +# UpdatePlanToResponse + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/updateplantype.md b/others/python-sdk/docs/models/updateplantype.md new file mode 100644 index 000000000..b9d2352c6 --- /dev/null +++ b/others/python-sdk/docs/models/updateplantype.md @@ -0,0 +1,14 @@ +# UpdatePlanType + +The type of the feature + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `STATIC` | static | +| `BOOLEAN` | boolean | +| `SINGLE_USE` | single_use | +| `CONTINUOUS_USE` | continuous_use | +| `CREDIT_SYSTEM` | credit_system | \ No newline at end of file diff --git a/others/python-sdk/docs/sdks/billing/README.md b/others/python-sdk/docs/sdks/billing/README.md index 0ee824016..4697b2006 100644 --- a/others/python-sdk/docs/sdks/billing/README.md +++ b/others/python-sdk/docs/sdks/billing/README.md @@ -17,6 +17,7 @@ Use this endpoint to update prepaid quantities, cancel a subscription (immediate Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. * [open_customer_portal](#open_customer_portal) - Create a billing portal session for a customer to manage their subscription. +* [setup_payment](#setup_payment) - Create a payment setup session for a customer to add or update their payment method. ## attach @@ -276,6 +277,49 @@ with Autumn( ### Errors +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## setup_payment + +Create a payment setup session for a customer to add or update their payment method. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.billing.setup_payment(customer_id="cus_123", success_url="https://example.com/account/billing") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer | +| `success_url` | *Optional[str]* | :heavy_minus_sign: | URL to redirect to after successful payment setup. Must start with either http:// or https:// | +| `customer_data` | [Optional[models.CustomerData]](../../models/customerdata.md) | :heavy_minus_sign: | Customer details to set when creating a customer | +| `checkout_session_params` | Dict[str, *Any*] | :heavy_minus_sign: | Additional parameters for the checkout session | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.SetupPaymentResponse](../../models/setuppaymentresponse.md)** + +### Errors + | Error Type | Status Code | Content Type | | ------------------------- | ------------------------- | ------------------------- | | errors.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/others/python-sdk/docs/sdks/plans/README.md b/others/python-sdk/docs/sdks/plans/README.md index 298f2d957..52a32271c 100644 --- a/others/python-sdk/docs/sdks/plans/README.md +++ b/others/python-sdk/docs/sdks/plans/README.md @@ -4,11 +4,118 @@ ### Available Operations +* [create](#create) - Create a plan +* [get](#get) - Get a plan * [list](#list) - List all plans +* [update](#update) - Update a plan +* [delete](#delete) - Delete a plan + +## create + +Creates a new plan with optional base price and feature configurations. + +Use this to programmatically create pricing plans. See [How plans work](/documentation/pricing/plans) for concepts. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.plans.create(plan_id="free_plan", name="Free", group="", add_on=False, auto_enable=True, items=[ + { + "feature_id": "messages", + "included": 100, + "reset": { + "interval": "month", + }, + }, + ]) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan to create. | +| `name` | *str* | :heavy_check_mark: | Display name of the plan. | +| `group` | *Optional[str]* | :heavy_minus_sign: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional description of the plan. | +| `add_on` | *Optional[bool]* | :heavy_minus_sign: | If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. | +| `auto_enable` | *Optional[bool]* | :heavy_minus_sign: | If true, plan is automatically attached when a customer is created. Use for free tiers. | +| `price` | [Optional[models.CreatePlanPriceRequest]](../../models/createplanpricerequest.md) | :heavy_minus_sign: | Base recurring price for the plan. Omit for free or usage-only plans. | +| `items` | List[[models.CreatePlanItemRequest](../../models/createplanitemrequest.md)] | :heavy_minus_sign: | Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. | +| `free_trial` | [Optional[models.CreatePlanFreeTrialRequest]](../../models/createplanfreetrialrequest.md) | :heavy_minus_sign: | Free trial configuration. Customers can try this plan before being charged. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.CreatePlanResponse](../../models/createplanresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## get + +Retrieves a single plan by its ID. + +Use this to fetch the full configuration of a specific plan, including its features and pricing. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.plans.get(plan_id="pro_plan") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan to retrieve. | +| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to get. Defaults to the latest version. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.GetPlanResponse](../../models/getplanresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | ## list -List all plans +Lists all plans in the current environment. + +Use this to retrieve all plans for displaying pricing pages or managing plan configurations. ### Example Usage @@ -22,7 +129,7 @@ with Autumn( secret_key="", ) as autumn: - res = autumn.plans.list() + res = autumn.plans.list(request={}) # Handle response print(res) @@ -33,7 +140,7 @@ with Autumn( | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `request` | [models.ListPlansRequest](../../models/listplansrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `request` | [models.ListPlansParams](../../models/listplansparams.md) | :heavy_check_mark: | The request object to use for the request. | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response @@ -42,6 +149,105 @@ with Autumn( ### Errors +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## update + +Updates an existing plan. Creates a new version unless `disableVersion` is set. + +Use this to modify plan properties, pricing, or feature configurations. See [Adding features to plans](/documentation/pricing/plan-features) for item configuration. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.plans.update(plan_id="pro_plan", group="", name="Pro Plan (Updated)", price={ + "amount": 15, + "interval": "month", + }, archived=False) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan to update. | +| `group` | *Optional[str]* | :heavy_minus_sign: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `name` | *Optional[str]* | :heavy_minus_sign: | Display name of the plan. | +| `description` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `add_on` | *Optional[bool]* | :heavy_minus_sign: | Whether the plan is an add-on. | +| `auto_enable` | *Optional[bool]* | :heavy_minus_sign: | Whether the plan is automatically enabled. | +| `price` | [OptionalNullable[models.UpdatePlanPriceRequest]](../../models/updateplanpricerequest.md) | :heavy_minus_sign: | The price of the plan. Set to null to remove the base price. | +| `items` | List[[models.UpdatePlanItemRequest](../../models/updateplanitemrequest.md)] | :heavy_minus_sign: | Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. | +| `free_trial` | [OptionalNullable[models.UpdatePlanFreeTrialRequest]](../../models/updateplanfreetrialrequest.md) | :heavy_minus_sign: | The free trial of the plan. Set to null to remove the free trial. | +| `version` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `archived` | *Optional[bool]* | :heavy_minus_sign: | N/A | +| `new_plan_id` | *Optional[str]* | :heavy_minus_sign: | The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.UpdatePlanResponse](../../models/updateplanresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## delete + +Deletes a plan by its ID. + +Use this to permanently remove a plan. Plans with active customers cannot be deleted - archive them instead. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.plans.delete(plan_id="unused_plan", all_versions=False) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan to delete. | +| `all_versions` | *Optional[bool]* | :heavy_minus_sign: | If true, deletes all versions of the plan. Otherwise, only deletes the latest version. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.DeletePlanResponse](../../models/deleteplanresponse.md)** + +### Errors + | Error Type | Status Code | Content Type | | ------------------------- | ------------------------- | ------------------------- | | errors.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/others/python-sdk/pyproject.toml b/others/python-sdk/pyproject.toml index e2831b291..7edc2f3dc 100644 --- a/others/python-sdk/pyproject.toml +++ b/others/python-sdk/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "autumn-sdk" -version = "0.4.8" +version = "0.4.15" description = "Python SDK for the Autumn billing API" authors = [{ name = "Autumn" },] readme = "README.md" diff --git a/others/python-sdk/src/autumn_sdk/_version.py b/others/python-sdk/src/autumn_sdk/_version.py index 19d30374e..9687a698f 100644 --- a/others/python-sdk/src/autumn_sdk/_version.py +++ b/others/python-sdk/src/autumn_sdk/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "autumn-sdk" -__version__: str = "0.4.8" +__version__: str = "0.4.15" __openapi_doc_version__: str = "2.1.0" __gen_version__: str = "2.824.1" -__user_agent__: str = "speakeasy-sdk/python 0.4.8 2.824.1 2.1.0 autumn-sdk" +__user_agent__: str = "speakeasy-sdk/python 0.4.15 2.824.1 2.1.0 autumn-sdk" try: if __package__ is not None: diff --git a/others/python-sdk/src/autumn_sdk/billing.py b/others/python-sdk/src/autumn_sdk/billing.py index bb52c0bb5..c2465a6c1 100644 --- a/others/python-sdk/src/autumn_sdk/billing.py +++ b/others/python-sdk/src/autumn_sdk/billing.py @@ -5,7 +5,7 @@ from autumn_sdk import errors, models, utils from autumn_sdk._hooks import HookContext from autumn_sdk.types import OptionalNullable, UNSET from autumn_sdk.utils.unmarshal_json_response import unmarshal_json_response -from typing import List, Mapping, Optional, Union +from typing import Any, Dict, List, Mapping, Optional, Union class Billing(BaseSDK): @@ -1392,3 +1392,209 @@ class Billing(BaseSDK): ) raise errors.AutumnDefaultError("Unexpected response received", http_res) + + def setup_payment( + self, + *, + customer_id: str, + success_url: Optional[str] = None, + customer_data: Optional[ + Union[models.CustomerData, models.CustomerDataTypedDict] + ] = None, + checkout_session_params: Optional[Dict[str, Any]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.SetupPaymentResponse: + r"""Create a payment setup session for a customer to add or update their payment method. + + :param customer_id: The ID of the customer + :param success_url: URL to redirect to after successful payment setup. Must start with either http:// or https:// + :param customer_data: Customer details to set when creating a customer + :param checkout_session_params: Additional parameters for the checkout session + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.SetupPaymentParams( + customer_id=customer_id, + success_url=success_url, + customer_data=utils.get_pydantic_model( + customer_data, Optional[models.CustomerData] + ), + checkout_session_params=checkout_session_params, + ) + + req = self._build_request( + method="POST", + path="/v1/billing.setup_payment", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.SetupPaymentGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.SetupPaymentParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="setupPayment", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.SetupPaymentResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def setup_payment_async( + self, + *, + customer_id: str, + success_url: Optional[str] = None, + customer_data: Optional[ + Union[models.CustomerData, models.CustomerDataTypedDict] + ] = None, + checkout_session_params: Optional[Dict[str, Any]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.SetupPaymentResponse: + r"""Create a payment setup session for a customer to add or update their payment method. + + :param customer_id: The ID of the customer + :param success_url: URL to redirect to after successful payment setup. Must start with either http:// or https:// + :param customer_data: Customer details to set when creating a customer + :param checkout_session_params: Additional parameters for the checkout session + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.SetupPaymentParams( + customer_id=customer_id, + success_url=success_url, + customer_data=utils.get_pydantic_model( + customer_data, Optional[models.CustomerData] + ), + checkout_session_params=checkout_session_params, + ) + + req = self._build_request_async( + method="POST", + path="/v1/billing.setup_payment", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.SetupPaymentGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.SetupPaymentParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="setupPayment", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.SetupPaymentResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) diff --git a/others/python-sdk/src/autumn_sdk/models/__init__.py b/others/python-sdk/src/autumn_sdk/models/__init__.py index ea15933e7..ab9795d4c 100644 --- a/others/python-sdk/src/autumn_sdk/models/__init__.py +++ b/others/python-sdk/src/autumn_sdk/models/__init__.py @@ -172,7 +172,6 @@ if TYPE_CHECKING: CheckResponseTypedDict, CheckRollover, CheckRolloverTypedDict, - CheckScenario, CheckTo, CheckToTypedDict, CheckType, @@ -188,6 +187,7 @@ if TYPE_CHECKING: ProductScenario, ProductTypedDict, RolloverDuration, + Scenario, Tiers, TiersTypedDict, UsageModel, @@ -237,6 +237,74 @@ if TYPE_CHECKING: CreateFeatureTypeRequest, CreateFeatureTypeResponse, ) + from .createplanop import ( + CreatePlanBillingMethodRequest, + CreatePlanBillingMethodResponse, + CreatePlanCreditSchema, + CreatePlanCreditSchemaTypedDict, + CreatePlanDurationTypeRequest, + CreatePlanDurationTypeResponse, + CreatePlanEnv, + CreatePlanExpiryDurationTypeRequest, + CreatePlanExpiryDurationTypeResponse, + CreatePlanFeature, + CreatePlanFeatureDisplay, + CreatePlanFeatureDisplayTypedDict, + CreatePlanFeatureTypedDict, + CreatePlanFreeTrialRequest, + CreatePlanFreeTrialRequestTypedDict, + CreatePlanFreeTrialResponse, + CreatePlanFreeTrialResponseTypedDict, + CreatePlanGlobals, + CreatePlanGlobalsTypedDict, + CreatePlanItemDisplay, + CreatePlanItemDisplayTypedDict, + CreatePlanItemPriceIntervalRequest, + CreatePlanItemPriceRequest, + CreatePlanItemPriceRequestTypedDict, + CreatePlanItemPriceResponse, + CreatePlanItemPriceResponseTypedDict, + CreatePlanItemRequest, + CreatePlanItemRequestTypedDict, + CreatePlanItemResponse, + CreatePlanItemResponseTypedDict, + CreatePlanOnDecrease, + CreatePlanOnIncrease, + CreatePlanParams, + CreatePlanParamsTypedDict, + CreatePlanPriceDisplay, + CreatePlanPriceDisplayTypedDict, + CreatePlanPriceIntervalRequest, + CreatePlanPriceIntervalResponse, + CreatePlanPriceItemIntervalResponse, + CreatePlanPriceRequest, + CreatePlanPriceRequestTypedDict, + CreatePlanPriceResponse, + CreatePlanPriceResponseTypedDict, + CreatePlanProration, + CreatePlanProrationTypedDict, + CreatePlanResetIntervalRequest, + CreatePlanResetIntervalResponse, + CreatePlanResetRequest, + CreatePlanResetRequestTypedDict, + CreatePlanResetResponse, + CreatePlanResetResponseTypedDict, + CreatePlanResponse, + CreatePlanResponseTypedDict, + CreatePlanRolloverRequest, + CreatePlanRolloverRequestTypedDict, + CreatePlanRolloverResponse, + CreatePlanRolloverResponseTypedDict, + CreatePlanTierRequest, + CreatePlanTierRequestTypedDict, + CreatePlanTierResponse, + CreatePlanTierResponseTypedDict, + CreatePlanToRequest, + CreatePlanToRequestTypedDict, + CreatePlanToResponse, + CreatePlanToResponseTypedDict, + CreatePlanType, + ) from .createreferralcodeop import ( CreateReferralCodeGlobals, CreateReferralCodeGlobalsTypedDict, @@ -298,6 +366,14 @@ if TYPE_CHECKING: DeleteFeatureResponse, DeleteFeatureResponseTypedDict, ) + from .deleteplanop import ( + DeletePlanGlobals, + DeletePlanGlobalsTypedDict, + DeletePlanParams, + DeletePlanParamsTypedDict, + DeletePlanResponse, + DeletePlanResponseTypedDict, + ) from .getentityop import ( GetEntityEnv, GetEntityGlobals, @@ -333,6 +409,48 @@ if TYPE_CHECKING: GetOrCreateCustomerParams, GetOrCreateCustomerParamsTypedDict, ) + from .getplanop import ( + GetPlanBillingMethod, + GetPlanCreditSchema, + GetPlanCreditSchemaTypedDict, + GetPlanDurationType, + GetPlanEnv, + GetPlanExpiryDurationType, + GetPlanFeature, + GetPlanFeatureDisplay, + GetPlanFeatureDisplayTypedDict, + GetPlanFeatureTypedDict, + GetPlanFreeTrial, + GetPlanFreeTrialTypedDict, + GetPlanGlobals, + GetPlanGlobalsTypedDict, + GetPlanItem, + GetPlanItemDisplay, + GetPlanItemDisplayTypedDict, + GetPlanItemPrice, + GetPlanItemPriceTypedDict, + GetPlanItemTypedDict, + GetPlanParams, + GetPlanParamsTypedDict, + GetPlanPrice, + GetPlanPriceDisplay, + GetPlanPriceDisplayTypedDict, + GetPlanPriceInterval, + GetPlanPriceItemInterval, + GetPlanPriceTypedDict, + GetPlanReset, + GetPlanResetInterval, + GetPlanResetTypedDict, + GetPlanResponse, + GetPlanResponseTypedDict, + GetPlanRollover, + GetPlanRolloverTypedDict, + GetPlanTier, + GetPlanTierTypedDict, + GetPlanTo, + GetPlanToTypedDict, + GetPlanType, + ) from .listcustomersop import ( ListCustomersEnv, ListCustomersGlobals, @@ -384,12 +502,48 @@ if TYPE_CHECKING: ListFeaturesType, ) from .listplansop import ( + ListPlansBillingMethod, + ListPlansCreditSchema, + ListPlansCreditSchemaTypedDict, + ListPlansDurationType, + ListPlansEnv, + ListPlansExpiryDurationType, + ListPlansFeature, + ListPlansFeatureDisplay, + ListPlansFeatureDisplayTypedDict, + ListPlansFeatureTypedDict, + ListPlansFreeTrial, + ListPlansFreeTrialTypedDict, ListPlansGlobals, ListPlansGlobalsTypedDict, - ListPlansRequest, - ListPlansRequestTypedDict, + ListPlansItem, + ListPlansItemDisplay, + ListPlansItemDisplayTypedDict, + ListPlansItemPrice, + ListPlansItemPriceTypedDict, + ListPlansItemTypedDict, + ListPlansList, + ListPlansListTypedDict, + ListPlansParams, + ListPlansParamsTypedDict, + ListPlansPrice, + ListPlansPriceDisplay, + ListPlansPriceDisplayTypedDict, + ListPlansPriceInterval, + ListPlansPriceItemInterval, + ListPlansPriceTypedDict, + ListPlansReset, + ListPlansResetInterval, + ListPlansResetTypedDict, ListPlansResponse, ListPlansResponseTypedDict, + ListPlansRollover, + ListPlansRolloverTypedDict, + ListPlansTier, + ListPlansTierTypedDict, + ListPlansTo, + ListPlansToTypedDict, + ListPlansType, ) from .opencustomerportalop import ( OpenCustomerPortalGlobals, @@ -400,15 +554,11 @@ if TYPE_CHECKING: OpenCustomerPortalResponseTypedDict, ) from .plan import ( - CustomerEligibility, - CustomerEligibilityTypedDict, ExpiryDurationType, FreeTrial, FreeTrialTypedDict, Item, ItemTypedDict, - OnDecrease, - OnIncrease, Plan, PlanBillingMethod, PlanCreditSchema, @@ -424,6 +574,8 @@ if TYPE_CHECKING: PlanItemPrice, PlanItemPriceTypedDict, PlanPrice, + PlanPriceDisplay, + PlanPriceDisplayTypedDict, PlanPriceInterval, PlanPriceItemInterval, PlanPriceTypedDict, @@ -438,11 +590,6 @@ if TYPE_CHECKING: PlanToTypedDict, PlanType, PlanTypedDict, - PriceDisplay, - PriceDisplayTypedDict, - Proration, - ProrationTypedDict, - Scenario, ) from .previewattachop import ( PreviewAttachBillingBehavior, @@ -555,6 +702,14 @@ if TYPE_CHECKING: RedeemReferralCodeResponseTypedDict, ) from .security import Security, SecurityTypedDict + from .setuppaymentop import ( + SetupPaymentGlobals, + SetupPaymentGlobalsTypedDict, + SetupPaymentParams, + SetupPaymentParamsTypedDict, + SetupPaymentResponse, + SetupPaymentResponseTypedDict, + ) from .trackop import ( TrackGlobals, TrackGlobalsTypedDict, @@ -604,6 +759,74 @@ if TYPE_CHECKING: UpdateFeatureTypeRequest, UpdateFeatureTypeResponse, ) + from .updateplanop import ( + UpdatePlanBillingMethodRequest, + UpdatePlanBillingMethodResponse, + UpdatePlanCreditSchema, + UpdatePlanCreditSchemaTypedDict, + UpdatePlanDurationTypeRequest, + UpdatePlanDurationTypeResponse, + UpdatePlanEnv, + UpdatePlanExpiryDurationTypeRequest, + UpdatePlanExpiryDurationTypeResponse, + UpdatePlanFeature, + UpdatePlanFeatureDisplay, + UpdatePlanFeatureDisplayTypedDict, + UpdatePlanFeatureTypedDict, + UpdatePlanFreeTrialRequest, + UpdatePlanFreeTrialRequestTypedDict, + UpdatePlanFreeTrialResponse, + UpdatePlanFreeTrialResponseTypedDict, + UpdatePlanGlobals, + UpdatePlanGlobalsTypedDict, + UpdatePlanItemDisplay, + UpdatePlanItemDisplayTypedDict, + UpdatePlanItemPriceIntervalRequest, + UpdatePlanItemPriceRequest, + UpdatePlanItemPriceRequestTypedDict, + UpdatePlanItemPriceResponse, + UpdatePlanItemPriceResponseTypedDict, + UpdatePlanItemRequest, + UpdatePlanItemRequestTypedDict, + UpdatePlanItemResponse, + UpdatePlanItemResponseTypedDict, + UpdatePlanOnDecrease, + UpdatePlanOnIncrease, + UpdatePlanParams, + UpdatePlanParamsTypedDict, + UpdatePlanPriceDisplay, + UpdatePlanPriceDisplayTypedDict, + UpdatePlanPriceIntervalRequest, + UpdatePlanPriceIntervalResponse, + UpdatePlanPriceItemIntervalResponse, + UpdatePlanPriceRequest, + UpdatePlanPriceRequestTypedDict, + UpdatePlanPriceResponse, + UpdatePlanPriceResponseTypedDict, + UpdatePlanProration, + UpdatePlanProrationTypedDict, + UpdatePlanResetIntervalRequest, + UpdatePlanResetIntervalResponse, + UpdatePlanResetRequest, + UpdatePlanResetRequestTypedDict, + UpdatePlanResetResponse, + UpdatePlanResetResponseTypedDict, + UpdatePlanResponse, + UpdatePlanResponseTypedDict, + UpdatePlanRolloverRequest, + UpdatePlanRolloverRequestTypedDict, + UpdatePlanRolloverResponse, + UpdatePlanRolloverResponseTypedDict, + UpdatePlanTierRequest, + UpdatePlanTierRequestTypedDict, + UpdatePlanTierResponse, + UpdatePlanTierResponseTypedDict, + UpdatePlanToRequest, + UpdatePlanToRequestTypedDict, + UpdatePlanToResponse, + UpdatePlanToResponseTypedDict, + UpdatePlanType, + ) __all__ = [ "AggregateEventsCustomRange", @@ -754,7 +977,6 @@ __all__ = [ "CheckResponseTypedDict", "CheckRollover", "CheckRolloverTypedDict", - "CheckScenario", "CheckTo", "CheckToTypedDict", "CheckType", @@ -799,6 +1021,72 @@ __all__ = [ "CreateFeatureResponseTypedDict", "CreateFeatureTypeRequest", "CreateFeatureTypeResponse", + "CreatePlanBillingMethodRequest", + "CreatePlanBillingMethodResponse", + "CreatePlanCreditSchema", + "CreatePlanCreditSchemaTypedDict", + "CreatePlanDurationTypeRequest", + "CreatePlanDurationTypeResponse", + "CreatePlanEnv", + "CreatePlanExpiryDurationTypeRequest", + "CreatePlanExpiryDurationTypeResponse", + "CreatePlanFeature", + "CreatePlanFeatureDisplay", + "CreatePlanFeatureDisplayTypedDict", + "CreatePlanFeatureTypedDict", + "CreatePlanFreeTrialRequest", + "CreatePlanFreeTrialRequestTypedDict", + "CreatePlanFreeTrialResponse", + "CreatePlanFreeTrialResponseTypedDict", + "CreatePlanGlobals", + "CreatePlanGlobalsTypedDict", + "CreatePlanItemDisplay", + "CreatePlanItemDisplayTypedDict", + "CreatePlanItemPriceIntervalRequest", + "CreatePlanItemPriceRequest", + "CreatePlanItemPriceRequestTypedDict", + "CreatePlanItemPriceResponse", + "CreatePlanItemPriceResponseTypedDict", + "CreatePlanItemRequest", + "CreatePlanItemRequestTypedDict", + "CreatePlanItemResponse", + "CreatePlanItemResponseTypedDict", + "CreatePlanOnDecrease", + "CreatePlanOnIncrease", + "CreatePlanParams", + "CreatePlanParamsTypedDict", + "CreatePlanPriceDisplay", + "CreatePlanPriceDisplayTypedDict", + "CreatePlanPriceIntervalRequest", + "CreatePlanPriceIntervalResponse", + "CreatePlanPriceItemIntervalResponse", + "CreatePlanPriceRequest", + "CreatePlanPriceRequestTypedDict", + "CreatePlanPriceResponse", + "CreatePlanPriceResponseTypedDict", + "CreatePlanProration", + "CreatePlanProrationTypedDict", + "CreatePlanResetIntervalRequest", + "CreatePlanResetIntervalResponse", + "CreatePlanResetRequest", + "CreatePlanResetRequestTypedDict", + "CreatePlanResetResponse", + "CreatePlanResetResponseTypedDict", + "CreatePlanResponse", + "CreatePlanResponseTypedDict", + "CreatePlanRolloverRequest", + "CreatePlanRolloverRequestTypedDict", + "CreatePlanRolloverResponse", + "CreatePlanRolloverResponseTypedDict", + "CreatePlanTierRequest", + "CreatePlanTierRequestTypedDict", + "CreatePlanTierResponse", + "CreatePlanTierResponseTypedDict", + "CreatePlanToRequest", + "CreatePlanToRequestTypedDict", + "CreatePlanToResponse", + "CreatePlanToResponseTypedDict", + "CreatePlanType", "CreateReferralCodeGlobals", "CreateReferralCodeGlobalsTypedDict", "CreateReferralCodeParams", @@ -809,8 +1097,6 @@ __all__ = [ "CustomerData", "CustomerDataTypedDict", "CustomerDurationType", - "CustomerEligibility", - "CustomerEligibilityTypedDict", "CustomerEnv", "CustomerExpand", "CustomerType", @@ -833,6 +1119,12 @@ __all__ = [ "DeleteFeatureParamsTypedDict", "DeleteFeatureResponse", "DeleteFeatureResponseTypedDict", + "DeletePlanGlobals", + "DeletePlanGlobalsTypedDict", + "DeletePlanParams", + "DeletePlanParamsTypedDict", + "DeletePlanResponse", + "DeletePlanResponseTypedDict", "Discount", "DiscountTypedDict", "Entity", @@ -876,6 +1168,46 @@ __all__ = [ "GetOrCreateCustomerGlobalsTypedDict", "GetOrCreateCustomerParams", "GetOrCreateCustomerParamsTypedDict", + "GetPlanBillingMethod", + "GetPlanCreditSchema", + "GetPlanCreditSchemaTypedDict", + "GetPlanDurationType", + "GetPlanEnv", + "GetPlanExpiryDurationType", + "GetPlanFeature", + "GetPlanFeatureDisplay", + "GetPlanFeatureDisplayTypedDict", + "GetPlanFeatureTypedDict", + "GetPlanFreeTrial", + "GetPlanFreeTrialTypedDict", + "GetPlanGlobals", + "GetPlanGlobalsTypedDict", + "GetPlanItem", + "GetPlanItemDisplay", + "GetPlanItemDisplayTypedDict", + "GetPlanItemPrice", + "GetPlanItemPriceTypedDict", + "GetPlanItemTypedDict", + "GetPlanParams", + "GetPlanParamsTypedDict", + "GetPlanPrice", + "GetPlanPriceDisplay", + "GetPlanPriceDisplayTypedDict", + "GetPlanPriceInterval", + "GetPlanPriceItemInterval", + "GetPlanPriceTypedDict", + "GetPlanReset", + "GetPlanResetInterval", + "GetPlanResetTypedDict", + "GetPlanResponse", + "GetPlanResponseTypedDict", + "GetPlanRollover", + "GetPlanRolloverTypedDict", + "GetPlanTier", + "GetPlanTierTypedDict", + "GetPlanTo", + "GetPlanToTypedDict", + "GetPlanType", "IncludedUsage", "IncludedUsageTypedDict", "Interval", @@ -925,14 +1257,48 @@ __all__ = [ "ListFeaturesResponse", "ListFeaturesResponseTypedDict", "ListFeaturesType", + "ListPlansBillingMethod", + "ListPlansCreditSchema", + "ListPlansCreditSchemaTypedDict", + "ListPlansDurationType", + "ListPlansEnv", + "ListPlansExpiryDurationType", + "ListPlansFeature", + "ListPlansFeatureDisplay", + "ListPlansFeatureDisplayTypedDict", + "ListPlansFeatureTypedDict", + "ListPlansFreeTrial", + "ListPlansFreeTrialTypedDict", "ListPlansGlobals", "ListPlansGlobalsTypedDict", - "ListPlansRequest", - "ListPlansRequestTypedDict", + "ListPlansItem", + "ListPlansItemDisplay", + "ListPlansItemDisplayTypedDict", + "ListPlansItemPrice", + "ListPlansItemPriceTypedDict", + "ListPlansItemTypedDict", + "ListPlansList", + "ListPlansListTypedDict", + "ListPlansParams", + "ListPlansParamsTypedDict", + "ListPlansPrice", + "ListPlansPriceDisplay", + "ListPlansPriceDisplayTypedDict", + "ListPlansPriceInterval", + "ListPlansPriceItemInterval", + "ListPlansPriceTypedDict", + "ListPlansReset", + "ListPlansResetInterval", + "ListPlansResetTypedDict", "ListPlansResponse", "ListPlansResponseTypedDict", - "OnDecrease", - "OnIncrease", + "ListPlansRollover", + "ListPlansRolloverTypedDict", + "ListPlansTier", + "ListPlansTierTypedDict", + "ListPlansTo", + "ListPlansToTypedDict", + "ListPlansType", "OpenCustomerPortalGlobals", "OpenCustomerPortalGlobalsTypedDict", "OpenCustomerPortalParams", @@ -954,6 +1320,8 @@ __all__ = [ "PlanItemPrice", "PlanItemPriceTypedDict", "PlanPrice", + "PlanPriceDisplay", + "PlanPriceDisplayTypedDict", "PlanPriceInterval", "PlanPriceItemInterval", "PlanPriceTypedDict", @@ -1068,13 +1436,9 @@ __all__ = [ "PreviewUpdateTierTypedDict", "PreviewUpdateTo", "PreviewUpdateToTypedDict", - "PriceDisplay", - "PriceDisplayTypedDict", "Product", "ProductScenario", "ProductTypedDict", - "Proration", - "ProrationTypedDict", "Purchase", "PurchaseTypedDict", "Range", @@ -1094,6 +1458,12 @@ __all__ = [ "Scenario", "Security", "SecurityTypedDict", + "SetupPaymentGlobals", + "SetupPaymentGlobalsTypedDict", + "SetupPaymentParams", + "SetupPaymentParamsTypedDict", + "SetupPaymentResponse", + "SetupPaymentResponseTypedDict", "Status", "Subscription", "SubscriptionStatus", @@ -1145,6 +1515,72 @@ __all__ = [ "UpdateFeatureResponseTypedDict", "UpdateFeatureTypeRequest", "UpdateFeatureTypeResponse", + "UpdatePlanBillingMethodRequest", + "UpdatePlanBillingMethodResponse", + "UpdatePlanCreditSchema", + "UpdatePlanCreditSchemaTypedDict", + "UpdatePlanDurationTypeRequest", + "UpdatePlanDurationTypeResponse", + "UpdatePlanEnv", + "UpdatePlanExpiryDurationTypeRequest", + "UpdatePlanExpiryDurationTypeResponse", + "UpdatePlanFeature", + "UpdatePlanFeatureDisplay", + "UpdatePlanFeatureDisplayTypedDict", + "UpdatePlanFeatureTypedDict", + "UpdatePlanFreeTrialRequest", + "UpdatePlanFreeTrialRequestTypedDict", + "UpdatePlanFreeTrialResponse", + "UpdatePlanFreeTrialResponseTypedDict", + "UpdatePlanGlobals", + "UpdatePlanGlobalsTypedDict", + "UpdatePlanItemDisplay", + "UpdatePlanItemDisplayTypedDict", + "UpdatePlanItemPriceIntervalRequest", + "UpdatePlanItemPriceRequest", + "UpdatePlanItemPriceRequestTypedDict", + "UpdatePlanItemPriceResponse", + "UpdatePlanItemPriceResponseTypedDict", + "UpdatePlanItemRequest", + "UpdatePlanItemRequestTypedDict", + "UpdatePlanItemResponse", + "UpdatePlanItemResponseTypedDict", + "UpdatePlanOnDecrease", + "UpdatePlanOnIncrease", + "UpdatePlanParams", + "UpdatePlanParamsTypedDict", + "UpdatePlanPriceDisplay", + "UpdatePlanPriceDisplayTypedDict", + "UpdatePlanPriceIntervalRequest", + "UpdatePlanPriceIntervalResponse", + "UpdatePlanPriceItemIntervalResponse", + "UpdatePlanPriceRequest", + "UpdatePlanPriceRequestTypedDict", + "UpdatePlanPriceResponse", + "UpdatePlanPriceResponseTypedDict", + "UpdatePlanProration", + "UpdatePlanProrationTypedDict", + "UpdatePlanResetIntervalRequest", + "UpdatePlanResetIntervalResponse", + "UpdatePlanResetRequest", + "UpdatePlanResetRequestTypedDict", + "UpdatePlanResetResponse", + "UpdatePlanResetResponseTypedDict", + "UpdatePlanResponse", + "UpdatePlanResponseTypedDict", + "UpdatePlanRolloverRequest", + "UpdatePlanRolloverRequestTypedDict", + "UpdatePlanRolloverResponse", + "UpdatePlanRolloverResponseTypedDict", + "UpdatePlanTierRequest", + "UpdatePlanTierRequestTypedDict", + "UpdatePlanTierResponse", + "UpdatePlanTierResponseTypedDict", + "UpdatePlanToRequest", + "UpdatePlanToRequestTypedDict", + "UpdatePlanToResponse", + "UpdatePlanToResponseTypedDict", + "UpdatePlanType", "UpdateSubscriptionParams", "UpdateSubscriptionParamsTypedDict", "UsageModel", @@ -1308,7 +1744,6 @@ _dynamic_imports: dict[str, str] = { "CheckResponseTypedDict": ".checkop", "CheckRollover": ".checkop", "CheckRolloverTypedDict": ".checkop", - "CheckScenario": ".checkop", "CheckTo": ".checkop", "CheckToTypedDict": ".checkop", "CheckType": ".checkop", @@ -1324,6 +1759,7 @@ _dynamic_imports: dict[str, str] = { "ProductScenario": ".checkop", "ProductTypedDict": ".checkop", "RolloverDuration": ".checkop", + "Scenario": ".checkop", "Tiers": ".checkop", "TiersTypedDict": ".checkop", "UsageModel": ".checkop", @@ -1366,6 +1802,72 @@ _dynamic_imports: dict[str, str] = { "CreateFeatureResponseTypedDict": ".createfeatureop", "CreateFeatureTypeRequest": ".createfeatureop", "CreateFeatureTypeResponse": ".createfeatureop", + "CreatePlanBillingMethodRequest": ".createplanop", + "CreatePlanBillingMethodResponse": ".createplanop", + "CreatePlanCreditSchema": ".createplanop", + "CreatePlanCreditSchemaTypedDict": ".createplanop", + "CreatePlanDurationTypeRequest": ".createplanop", + "CreatePlanDurationTypeResponse": ".createplanop", + "CreatePlanEnv": ".createplanop", + "CreatePlanExpiryDurationTypeRequest": ".createplanop", + "CreatePlanExpiryDurationTypeResponse": ".createplanop", + "CreatePlanFeature": ".createplanop", + "CreatePlanFeatureDisplay": ".createplanop", + "CreatePlanFeatureDisplayTypedDict": ".createplanop", + "CreatePlanFeatureTypedDict": ".createplanop", + "CreatePlanFreeTrialRequest": ".createplanop", + "CreatePlanFreeTrialRequestTypedDict": ".createplanop", + "CreatePlanFreeTrialResponse": ".createplanop", + "CreatePlanFreeTrialResponseTypedDict": ".createplanop", + "CreatePlanGlobals": ".createplanop", + "CreatePlanGlobalsTypedDict": ".createplanop", + "CreatePlanItemDisplay": ".createplanop", + "CreatePlanItemDisplayTypedDict": ".createplanop", + "CreatePlanItemPriceIntervalRequest": ".createplanop", + "CreatePlanItemPriceRequest": ".createplanop", + "CreatePlanItemPriceRequestTypedDict": ".createplanop", + "CreatePlanItemPriceResponse": ".createplanop", + "CreatePlanItemPriceResponseTypedDict": ".createplanop", + "CreatePlanItemRequest": ".createplanop", + "CreatePlanItemRequestTypedDict": ".createplanop", + "CreatePlanItemResponse": ".createplanop", + "CreatePlanItemResponseTypedDict": ".createplanop", + "CreatePlanOnDecrease": ".createplanop", + "CreatePlanOnIncrease": ".createplanop", + "CreatePlanParams": ".createplanop", + "CreatePlanParamsTypedDict": ".createplanop", + "CreatePlanPriceDisplay": ".createplanop", + "CreatePlanPriceDisplayTypedDict": ".createplanop", + "CreatePlanPriceIntervalRequest": ".createplanop", + "CreatePlanPriceIntervalResponse": ".createplanop", + "CreatePlanPriceItemIntervalResponse": ".createplanop", + "CreatePlanPriceRequest": ".createplanop", + "CreatePlanPriceRequestTypedDict": ".createplanop", + "CreatePlanPriceResponse": ".createplanop", + "CreatePlanPriceResponseTypedDict": ".createplanop", + "CreatePlanProration": ".createplanop", + "CreatePlanProrationTypedDict": ".createplanop", + "CreatePlanResetIntervalRequest": ".createplanop", + "CreatePlanResetIntervalResponse": ".createplanop", + "CreatePlanResetRequest": ".createplanop", + "CreatePlanResetRequestTypedDict": ".createplanop", + "CreatePlanResetResponse": ".createplanop", + "CreatePlanResetResponseTypedDict": ".createplanop", + "CreatePlanResponse": ".createplanop", + "CreatePlanResponseTypedDict": ".createplanop", + "CreatePlanRolloverRequest": ".createplanop", + "CreatePlanRolloverRequestTypedDict": ".createplanop", + "CreatePlanRolloverResponse": ".createplanop", + "CreatePlanRolloverResponseTypedDict": ".createplanop", + "CreatePlanTierRequest": ".createplanop", + "CreatePlanTierRequestTypedDict": ".createplanop", + "CreatePlanTierResponse": ".createplanop", + "CreatePlanTierResponseTypedDict": ".createplanop", + "CreatePlanToRequest": ".createplanop", + "CreatePlanToRequestTypedDict": ".createplanop", + "CreatePlanToResponse": ".createplanop", + "CreatePlanToResponseTypedDict": ".createplanop", + "CreatePlanType": ".createplanop", "CreateReferralCodeGlobals": ".createreferralcodeop", "CreateReferralCodeGlobalsTypedDict": ".createreferralcodeop", "CreateReferralCodeParams": ".createreferralcodeop", @@ -1418,6 +1920,12 @@ _dynamic_imports: dict[str, str] = { "DeleteFeatureParamsTypedDict": ".deletefeatureop", "DeleteFeatureResponse": ".deletefeatureop", "DeleteFeatureResponseTypedDict": ".deletefeatureop", + "DeletePlanGlobals": ".deleteplanop", + "DeletePlanGlobalsTypedDict": ".deleteplanop", + "DeletePlanParams": ".deleteplanop", + "DeletePlanParamsTypedDict": ".deleteplanop", + "DeletePlanResponse": ".deleteplanop", + "DeletePlanResponseTypedDict": ".deleteplanop", "GetEntityEnv": ".getentityop", "GetEntityGlobals": ".getentityop", "GetEntityGlobalsTypedDict": ".getentityop", @@ -1447,6 +1955,46 @@ _dynamic_imports: dict[str, str] = { "GetOrCreateCustomerGlobalsTypedDict": ".getorcreatecustomerop", "GetOrCreateCustomerParams": ".getorcreatecustomerop", "GetOrCreateCustomerParamsTypedDict": ".getorcreatecustomerop", + "GetPlanBillingMethod": ".getplanop", + "GetPlanCreditSchema": ".getplanop", + "GetPlanCreditSchemaTypedDict": ".getplanop", + "GetPlanDurationType": ".getplanop", + "GetPlanEnv": ".getplanop", + "GetPlanExpiryDurationType": ".getplanop", + "GetPlanFeature": ".getplanop", + "GetPlanFeatureDisplay": ".getplanop", + "GetPlanFeatureDisplayTypedDict": ".getplanop", + "GetPlanFeatureTypedDict": ".getplanop", + "GetPlanFreeTrial": ".getplanop", + "GetPlanFreeTrialTypedDict": ".getplanop", + "GetPlanGlobals": ".getplanop", + "GetPlanGlobalsTypedDict": ".getplanop", + "GetPlanItem": ".getplanop", + "GetPlanItemDisplay": ".getplanop", + "GetPlanItemDisplayTypedDict": ".getplanop", + "GetPlanItemPrice": ".getplanop", + "GetPlanItemPriceTypedDict": ".getplanop", + "GetPlanItemTypedDict": ".getplanop", + "GetPlanParams": ".getplanop", + "GetPlanParamsTypedDict": ".getplanop", + "GetPlanPrice": ".getplanop", + "GetPlanPriceDisplay": ".getplanop", + "GetPlanPriceDisplayTypedDict": ".getplanop", + "GetPlanPriceInterval": ".getplanop", + "GetPlanPriceItemInterval": ".getplanop", + "GetPlanPriceTypedDict": ".getplanop", + "GetPlanReset": ".getplanop", + "GetPlanResetInterval": ".getplanop", + "GetPlanResetTypedDict": ".getplanop", + "GetPlanResponse": ".getplanop", + "GetPlanResponseTypedDict": ".getplanop", + "GetPlanRollover": ".getplanop", + "GetPlanRolloverTypedDict": ".getplanop", + "GetPlanTier": ".getplanop", + "GetPlanTierTypedDict": ".getplanop", + "GetPlanTo": ".getplanop", + "GetPlanToTypedDict": ".getplanop", + "GetPlanType": ".getplanop", "ListCustomersEnv": ".listcustomersop", "ListCustomersGlobals": ".listcustomersop", "ListCustomersGlobalsTypedDict": ".listcustomersop", @@ -1491,27 +2039,59 @@ _dynamic_imports: dict[str, str] = { "ListFeaturesResponse": ".listfeaturesop", "ListFeaturesResponseTypedDict": ".listfeaturesop", "ListFeaturesType": ".listfeaturesop", + "ListPlansBillingMethod": ".listplansop", + "ListPlansCreditSchema": ".listplansop", + "ListPlansCreditSchemaTypedDict": ".listplansop", + "ListPlansDurationType": ".listplansop", + "ListPlansEnv": ".listplansop", + "ListPlansExpiryDurationType": ".listplansop", + "ListPlansFeature": ".listplansop", + "ListPlansFeatureDisplay": ".listplansop", + "ListPlansFeatureDisplayTypedDict": ".listplansop", + "ListPlansFeatureTypedDict": ".listplansop", + "ListPlansFreeTrial": ".listplansop", + "ListPlansFreeTrialTypedDict": ".listplansop", "ListPlansGlobals": ".listplansop", "ListPlansGlobalsTypedDict": ".listplansop", - "ListPlansRequest": ".listplansop", - "ListPlansRequestTypedDict": ".listplansop", + "ListPlansItem": ".listplansop", + "ListPlansItemDisplay": ".listplansop", + "ListPlansItemDisplayTypedDict": ".listplansop", + "ListPlansItemPrice": ".listplansop", + "ListPlansItemPriceTypedDict": ".listplansop", + "ListPlansItemTypedDict": ".listplansop", + "ListPlansList": ".listplansop", + "ListPlansListTypedDict": ".listplansop", + "ListPlansParams": ".listplansop", + "ListPlansParamsTypedDict": ".listplansop", + "ListPlansPrice": ".listplansop", + "ListPlansPriceDisplay": ".listplansop", + "ListPlansPriceDisplayTypedDict": ".listplansop", + "ListPlansPriceInterval": ".listplansop", + "ListPlansPriceItemInterval": ".listplansop", + "ListPlansPriceTypedDict": ".listplansop", + "ListPlansReset": ".listplansop", + "ListPlansResetInterval": ".listplansop", + "ListPlansResetTypedDict": ".listplansop", "ListPlansResponse": ".listplansop", "ListPlansResponseTypedDict": ".listplansop", + "ListPlansRollover": ".listplansop", + "ListPlansRolloverTypedDict": ".listplansop", + "ListPlansTier": ".listplansop", + "ListPlansTierTypedDict": ".listplansop", + "ListPlansTo": ".listplansop", + "ListPlansToTypedDict": ".listplansop", + "ListPlansType": ".listplansop", "OpenCustomerPortalGlobals": ".opencustomerportalop", "OpenCustomerPortalGlobalsTypedDict": ".opencustomerportalop", "OpenCustomerPortalParams": ".opencustomerportalop", "OpenCustomerPortalParamsTypedDict": ".opencustomerportalop", "OpenCustomerPortalResponse": ".opencustomerportalop", "OpenCustomerPortalResponseTypedDict": ".opencustomerportalop", - "CustomerEligibility": ".plan", - "CustomerEligibilityTypedDict": ".plan", "ExpiryDurationType": ".plan", "FreeTrial": ".plan", "FreeTrialTypedDict": ".plan", "Item": ".plan", "ItemTypedDict": ".plan", - "OnDecrease": ".plan", - "OnIncrease": ".plan", "Plan": ".plan", "PlanBillingMethod": ".plan", "PlanCreditSchema": ".plan", @@ -1527,6 +2107,8 @@ _dynamic_imports: dict[str, str] = { "PlanItemPrice": ".plan", "PlanItemPriceTypedDict": ".plan", "PlanPrice": ".plan", + "PlanPriceDisplay": ".plan", + "PlanPriceDisplayTypedDict": ".plan", "PlanPriceInterval": ".plan", "PlanPriceItemInterval": ".plan", "PlanPriceTypedDict": ".plan", @@ -1541,11 +2123,6 @@ _dynamic_imports: dict[str, str] = { "PlanToTypedDict": ".plan", "PlanType": ".plan", "PlanTypedDict": ".plan", - "PriceDisplay": ".plan", - "PriceDisplayTypedDict": ".plan", - "Proration": ".plan", - "ProrationTypedDict": ".plan", - "Scenario": ".plan", "PreviewAttachBillingBehavior": ".previewattachop", "PreviewAttachBillingMethod": ".previewattachop", "PreviewAttachCustomize": ".previewattachop", @@ -1652,6 +2229,12 @@ _dynamic_imports: dict[str, str] = { "RedeemReferralCodeResponseTypedDict": ".redeemreferralcodeop", "Security": ".security", "SecurityTypedDict": ".security", + "SetupPaymentGlobals": ".setuppaymentop", + "SetupPaymentGlobalsTypedDict": ".setuppaymentop", + "SetupPaymentParams": ".setuppaymentop", + "SetupPaymentParamsTypedDict": ".setuppaymentop", + "SetupPaymentResponse": ".setuppaymentop", + "SetupPaymentResponseTypedDict": ".setuppaymentop", "TrackGlobals": ".trackop", "TrackGlobalsTypedDict": ".trackop", "TrackParams": ".trackop", @@ -1693,6 +2276,72 @@ _dynamic_imports: dict[str, str] = { "UpdateFeatureResponseTypedDict": ".updatefeatureop", "UpdateFeatureTypeRequest": ".updatefeatureop", "UpdateFeatureTypeResponse": ".updatefeatureop", + "UpdatePlanBillingMethodRequest": ".updateplanop", + "UpdatePlanBillingMethodResponse": ".updateplanop", + "UpdatePlanCreditSchema": ".updateplanop", + "UpdatePlanCreditSchemaTypedDict": ".updateplanop", + "UpdatePlanDurationTypeRequest": ".updateplanop", + "UpdatePlanDurationTypeResponse": ".updateplanop", + "UpdatePlanEnv": ".updateplanop", + "UpdatePlanExpiryDurationTypeRequest": ".updateplanop", + "UpdatePlanExpiryDurationTypeResponse": ".updateplanop", + "UpdatePlanFeature": ".updateplanop", + "UpdatePlanFeatureDisplay": ".updateplanop", + "UpdatePlanFeatureDisplayTypedDict": ".updateplanop", + "UpdatePlanFeatureTypedDict": ".updateplanop", + "UpdatePlanFreeTrialRequest": ".updateplanop", + "UpdatePlanFreeTrialRequestTypedDict": ".updateplanop", + "UpdatePlanFreeTrialResponse": ".updateplanop", + "UpdatePlanFreeTrialResponseTypedDict": ".updateplanop", + "UpdatePlanGlobals": ".updateplanop", + "UpdatePlanGlobalsTypedDict": ".updateplanop", + "UpdatePlanItemDisplay": ".updateplanop", + "UpdatePlanItemDisplayTypedDict": ".updateplanop", + "UpdatePlanItemPriceIntervalRequest": ".updateplanop", + "UpdatePlanItemPriceRequest": ".updateplanop", + "UpdatePlanItemPriceRequestTypedDict": ".updateplanop", + "UpdatePlanItemPriceResponse": ".updateplanop", + "UpdatePlanItemPriceResponseTypedDict": ".updateplanop", + "UpdatePlanItemRequest": ".updateplanop", + "UpdatePlanItemRequestTypedDict": ".updateplanop", + "UpdatePlanItemResponse": ".updateplanop", + "UpdatePlanItemResponseTypedDict": ".updateplanop", + "UpdatePlanOnDecrease": ".updateplanop", + "UpdatePlanOnIncrease": ".updateplanop", + "UpdatePlanParams": ".updateplanop", + "UpdatePlanParamsTypedDict": ".updateplanop", + "UpdatePlanPriceDisplay": ".updateplanop", + "UpdatePlanPriceDisplayTypedDict": ".updateplanop", + "UpdatePlanPriceIntervalRequest": ".updateplanop", + "UpdatePlanPriceIntervalResponse": ".updateplanop", + "UpdatePlanPriceItemIntervalResponse": ".updateplanop", + "UpdatePlanPriceRequest": ".updateplanop", + "UpdatePlanPriceRequestTypedDict": ".updateplanop", + "UpdatePlanPriceResponse": ".updateplanop", + "UpdatePlanPriceResponseTypedDict": ".updateplanop", + "UpdatePlanProration": ".updateplanop", + "UpdatePlanProrationTypedDict": ".updateplanop", + "UpdatePlanResetIntervalRequest": ".updateplanop", + "UpdatePlanResetIntervalResponse": ".updateplanop", + "UpdatePlanResetRequest": ".updateplanop", + "UpdatePlanResetRequestTypedDict": ".updateplanop", + "UpdatePlanResetResponse": ".updateplanop", + "UpdatePlanResetResponseTypedDict": ".updateplanop", + "UpdatePlanResponse": ".updateplanop", + "UpdatePlanResponseTypedDict": ".updateplanop", + "UpdatePlanRolloverRequest": ".updateplanop", + "UpdatePlanRolloverRequestTypedDict": ".updateplanop", + "UpdatePlanRolloverResponse": ".updateplanop", + "UpdatePlanRolloverResponseTypedDict": ".updateplanop", + "UpdatePlanTierRequest": ".updateplanop", + "UpdatePlanTierRequestTypedDict": ".updateplanop", + "UpdatePlanTierResponse": ".updateplanop", + "UpdatePlanTierResponseTypedDict": ".updateplanop", + "UpdatePlanToRequest": ".updateplanop", + "UpdatePlanToRequestTypedDict": ".updateplanop", + "UpdatePlanToResponse": ".updateplanop", + "UpdatePlanToResponseTypedDict": ".updateplanop", + "UpdatePlanType": ".updateplanop", } diff --git a/others/python-sdk/src/autumn_sdk/models/billingattachop.py b/others/python-sdk/src/autumn_sdk/models/billingattachop.py index c1b7c3cee..59ce78a23 100644 --- a/others/python-sdk/src/autumn_sdk/models/billingattachop.py +++ b/others/python-sdk/src/autumn_sdk/models/billingattachop.py @@ -79,20 +79,27 @@ BillingAttachDurationType = Literal[ "month", "year", ] +r"""Unit of time for the trial ('day', 'month', 'year').""" class BillingAttachFreeTrialTypedDict(TypedDict): duration_length: float + r"""Number of duration_type periods the trial lasts.""" duration_type: NotRequired[BillingAttachDurationType] + r"""Unit of time for the trial ('day', 'month', 'year').""" card_required: NotRequired[bool] + r"""If true, payment method required to start trial. Customer is charged after trial ends.""" class BillingAttachFreeTrial(BaseModel): duration_length: float + r"""Number of duration_type periods the trial lasts.""" duration_type: Optional[BillingAttachDurationType] = "month" + r"""Unit of time for the trial ('day', 'month', 'year').""" card_required: Optional[bool] = True + r"""If true, payment method required to start trial. Customer is charged after trial ends.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -119,20 +126,27 @@ BillingAttachPriceInterval = Literal[ "semi_annual", "year", ] +r"""Billing interval (e.g. 'month', 'year').""" class BillingAttachPriceTypedDict(TypedDict): amount: float + r"""Base price amount for the plan.""" interval: BillingAttachPriceInterval + r"""Billing interval (e.g. 'month', 'year').""" interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" class BillingAttachPrice(BaseModel): amount: float + r"""Base price amount for the plan.""" interval: BillingAttachPriceInterval + r"""Billing interval (e.g. 'month', 'year').""" interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -162,17 +176,26 @@ BillingAttachResetInterval = Literal[ "semi_annual", "year", ] +r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" class BillingAttachResetTypedDict(TypedDict): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + interval: BillingAttachResetInterval + r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" interval_count: NotRequired[float] + r"""Number of intervals between resets. Defaults to 1.""" class BillingAttachReset(BaseModel): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + interval: BillingAttachResetInterval + r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" interval_count: Optional[float] = None + r"""Number of intervals between resets. Defaults to 1.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -216,38 +239,58 @@ BillingAttachItemPriceInterval = Literal[ "semi_annual", "year", ] +r"""Billing interval. For consumable features, should match reset.interval.""" BillingAttachBillingMethod = Literal[ "prepaid", "usage_based", ] +r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" class BillingAttachItemPriceTypedDict(TypedDict): + r"""Pricing for usage beyond included units. Omit for free features.""" + interval: BillingAttachItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" billing_method: BillingAttachBillingMethod + r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" amount: NotRequired[float] + r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required.""" tiers: NotRequired[List[BillingAttachTierTypedDict]] + r"""Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required.""" interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: NotRequired[float] + r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).""" max_purchase: NotRequired[float] + r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.""" class BillingAttachItemPrice(BaseModel): + r"""Pricing for usage beyond included units. Omit for free features.""" + interval: BillingAttachItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" billing_method: BillingAttachBillingMethod + r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" amount: Optional[float] = None + r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required.""" tiers: Optional[List[BillingAttachTier]] = None + r"""Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required.""" interval_count: Optional[float] = 1 + r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: Optional[float] = 1 + r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).""" max_purchase: Optional[float] = None + r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -274,6 +317,7 @@ BillingAttachOnIncrease = Literal[ "prorate_next_cycle", "bill_next_cycle", ] +r"""Billing behavior when quantity increases mid-cycle.""" BillingAttachOnDecrease = Literal[ @@ -283,37 +327,57 @@ BillingAttachOnDecrease = Literal[ "none", "no_prorations", ] +r"""Credit behavior when quantity decreases mid-cycle.""" class BillingAttachProrationTypedDict(TypedDict): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + on_increase: BillingAttachOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" on_decrease: BillingAttachOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" class BillingAttachProration(BaseModel): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + on_increase: BillingAttachOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" on_decrease: BillingAttachOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" BillingAttachExpiryDurationType = Literal[ "month", "forever", ] +r"""When rolled over units expire.""" class BillingAttachRolloverTypedDict(TypedDict): + r"""Rollover config for unused units. If set, unused included units carry over.""" + expiry_duration_type: BillingAttachExpiryDurationType + r"""When rolled over units expire.""" max: NotRequired[float] + r"""Max rollover units. Omit for unlimited rollover.""" expiry_duration_length: NotRequired[float] + r"""Number of periods before expiry.""" class BillingAttachRollover(BaseModel): + r"""Rollover config for unused units. If set, unused included units carry over.""" + expiry_duration_type: BillingAttachExpiryDurationType + r"""When rolled over units expire.""" max: Optional[float] = None + r"""Max rollover units. Omit for unlimited rollover.""" expiry_duration_length: Optional[float] = None + r"""Number of periods before expiry.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -334,28 +398,42 @@ class BillingAttachRollover(BaseModel): class BillingAttachItemTypedDict(TypedDict): feature_id: str + r"""The ID of the feature to configure.""" included: NotRequired[float] + r"""Number of free units included. Balance resets to this each interval for consumable features.""" unlimited: NotRequired[bool] + r"""If true, customer has unlimited access to this feature.""" reset: NotRequired[BillingAttachResetTypedDict] + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" price: NotRequired[BillingAttachItemPriceTypedDict] + r"""Pricing for usage beyond included units. Omit for free features.""" proration: NotRequired[BillingAttachProrationTypedDict] + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" rollover: NotRequired[BillingAttachRolloverTypedDict] + r"""Rollover config for unused units. If set, unused included units carry over.""" class BillingAttachItem(BaseModel): feature_id: str + r"""The ID of the feature to configure.""" included: Optional[float] = None + r"""Number of free units included. Balance resets to this each interval for consumable features.""" unlimited: Optional[bool] = None + r"""If true, customer has unlimited access to this feature.""" reset: Optional[BillingAttachReset] = None + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" price: Optional[BillingAttachItemPrice] = None + r"""Pricing for usage beyond included units. Omit for free features.""" proration: Optional[BillingAttachProration] = None + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" rollover: Optional[BillingAttachRollover] = None + r"""Rollover config for unused units. If set, unused included units carry over.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/others/python-sdk/src/autumn_sdk/models/billingupdateop.py b/others/python-sdk/src/autumn_sdk/models/billingupdateop.py index c96d4631e..f255a231b 100644 --- a/others/python-sdk/src/autumn_sdk/models/billingupdateop.py +++ b/others/python-sdk/src/autumn_sdk/models/billingupdateop.py @@ -79,20 +79,27 @@ BillingUpdateDurationType = Literal[ "month", "year", ] +r"""Unit of time for the trial ('day', 'month', 'year').""" class BillingUpdateFreeTrialTypedDict(TypedDict): duration_length: float + r"""Number of duration_type periods the trial lasts.""" duration_type: NotRequired[BillingUpdateDurationType] + r"""Unit of time for the trial ('day', 'month', 'year').""" card_required: NotRequired[bool] + r"""If true, payment method required to start trial. Customer is charged after trial ends.""" class BillingUpdateFreeTrial(BaseModel): duration_length: float + r"""Number of duration_type periods the trial lasts.""" duration_type: Optional[BillingUpdateDurationType] = "month" + r"""Unit of time for the trial ('day', 'month', 'year').""" card_required: Optional[bool] = True + r"""If true, payment method required to start trial. Customer is charged after trial ends.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -119,20 +126,27 @@ BillingUpdatePriceInterval = Literal[ "semi_annual", "year", ] +r"""Billing interval (e.g. 'month', 'year').""" class BillingUpdatePriceTypedDict(TypedDict): amount: float + r"""Base price amount for the plan.""" interval: BillingUpdatePriceInterval + r"""Billing interval (e.g. 'month', 'year').""" interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" class BillingUpdatePrice(BaseModel): amount: float + r"""Base price amount for the plan.""" interval: BillingUpdatePriceInterval + r"""Billing interval (e.g. 'month', 'year').""" interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -162,17 +176,26 @@ BillingUpdateResetInterval = Literal[ "semi_annual", "year", ] +r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" class BillingUpdateResetTypedDict(TypedDict): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + interval: BillingUpdateResetInterval + r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" interval_count: NotRequired[float] + r"""Number of intervals between resets. Defaults to 1.""" class BillingUpdateReset(BaseModel): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + interval: BillingUpdateResetInterval + r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" interval_count: Optional[float] = None + r"""Number of intervals between resets. Defaults to 1.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -216,38 +239,58 @@ BillingUpdateItemPriceInterval = Literal[ "semi_annual", "year", ] +r"""Billing interval. For consumable features, should match reset.interval.""" BillingUpdateBillingMethod = Literal[ "prepaid", "usage_based", ] +r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" class BillingUpdateItemPriceTypedDict(TypedDict): + r"""Pricing for usage beyond included units. Omit for free features.""" + interval: BillingUpdateItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" billing_method: BillingUpdateBillingMethod + r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" amount: NotRequired[float] + r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required.""" tiers: NotRequired[List[BillingUpdateTierTypedDict]] + r"""Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required.""" interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: NotRequired[float] + r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).""" max_purchase: NotRequired[float] + r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.""" class BillingUpdateItemPrice(BaseModel): + r"""Pricing for usage beyond included units. Omit for free features.""" + interval: BillingUpdateItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" billing_method: BillingUpdateBillingMethod + r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" amount: Optional[float] = None + r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required.""" tiers: Optional[List[BillingUpdateTier]] = None + r"""Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required.""" interval_count: Optional[float] = 1 + r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: Optional[float] = 1 + r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).""" max_purchase: Optional[float] = None + r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -274,6 +317,7 @@ BillingUpdateOnIncrease = Literal[ "prorate_next_cycle", "bill_next_cycle", ] +r"""Billing behavior when quantity increases mid-cycle.""" BillingUpdateOnDecrease = Literal[ @@ -283,37 +327,57 @@ BillingUpdateOnDecrease = Literal[ "none", "no_prorations", ] +r"""Credit behavior when quantity decreases mid-cycle.""" class BillingUpdateProrationTypedDict(TypedDict): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + on_increase: BillingUpdateOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" on_decrease: BillingUpdateOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" class BillingUpdateProration(BaseModel): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + on_increase: BillingUpdateOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" on_decrease: BillingUpdateOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" BillingUpdateExpiryDurationType = Literal[ "month", "forever", ] +r"""When rolled over units expire.""" class BillingUpdateRolloverTypedDict(TypedDict): + r"""Rollover config for unused units. If set, unused included units carry over.""" + expiry_duration_type: BillingUpdateExpiryDurationType + r"""When rolled over units expire.""" max: NotRequired[float] + r"""Max rollover units. Omit for unlimited rollover.""" expiry_duration_length: NotRequired[float] + r"""Number of periods before expiry.""" class BillingUpdateRollover(BaseModel): + r"""Rollover config for unused units. If set, unused included units carry over.""" + expiry_duration_type: BillingUpdateExpiryDurationType + r"""When rolled over units expire.""" max: Optional[float] = None + r"""Max rollover units. Omit for unlimited rollover.""" expiry_duration_length: Optional[float] = None + r"""Number of periods before expiry.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -334,28 +398,42 @@ class BillingUpdateRollover(BaseModel): class BillingUpdateItemTypedDict(TypedDict): feature_id: str + r"""The ID of the feature to configure.""" included: NotRequired[float] + r"""Number of free units included. Balance resets to this each interval for consumable features.""" unlimited: NotRequired[bool] + r"""If true, customer has unlimited access to this feature.""" reset: NotRequired[BillingUpdateResetTypedDict] + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" price: NotRequired[BillingUpdateItemPriceTypedDict] + r"""Pricing for usage beyond included units. Omit for free features.""" proration: NotRequired[BillingUpdateProrationTypedDict] + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" rollover: NotRequired[BillingUpdateRolloverTypedDict] + r"""Rollover config for unused units. If set, unused included units carry over.""" class BillingUpdateItem(BaseModel): feature_id: str + r"""The ID of the feature to configure.""" included: Optional[float] = None + r"""Number of free units included. Balance resets to this each interval for consumable features.""" unlimited: Optional[bool] = None + r"""If true, customer has unlimited access to this feature.""" reset: Optional[BillingUpdateReset] = None + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" price: Optional[BillingUpdateItemPrice] = None + r"""Pricing for usage beyond included units. Omit for free features.""" proration: Optional[BillingUpdateProration] = None + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" rollover: Optional[BillingUpdateRollover] = None + r"""Rollover config for unused units. If set, unused included units carry over.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/others/python-sdk/src/autumn_sdk/models/checkop.py b/others/python-sdk/src/autumn_sdk/models/checkop.py index 3dc1534e5..21a4f89c0 100644 --- a/others/python-sdk/src/autumn_sdk/models/checkop.py +++ b/others/python-sdk/src/autumn_sdk/models/checkop.py @@ -109,7 +109,7 @@ class CheckParams(BaseModel): return m -CheckScenario = Union[ +Scenario = Union[ Literal[ "usage_limit", "feature_flag", @@ -740,7 +740,7 @@ class Product(BaseModel): class PreviewTypedDict(TypedDict): r"""Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false.""" - scenario: CheckScenario + scenario: Scenario r"""The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan.""" title: str r"""A title suitable for displaying in a paywall or upgrade modal.""" @@ -757,7 +757,7 @@ class PreviewTypedDict(TypedDict): class Preview(BaseModel): r"""Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false.""" - scenario: CheckScenario + scenario: Scenario r"""The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan.""" title: str diff --git a/others/python-sdk/src/autumn_sdk/models/createplanop.py b/others/python-sdk/src/autumn_sdk/models/createplanop.py new file mode 100644 index 000000000..78e018148 --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/createplanop.py @@ -0,0 +1,1185 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from autumn_sdk.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class CreatePlanGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class CreatePlanGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +CreatePlanPriceIntervalRequest = Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", +] +r"""Billing interval (e.g. 'month', 'year').""" + + +class CreatePlanPriceRequestTypedDict(TypedDict): + r"""Base recurring price for the plan. Omit for free or usage-only plans.""" + + amount: float + r"""Base price amount for the plan.""" + interval: CreatePlanPriceIntervalRequest + r"""Billing interval (e.g. 'month', 'year').""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + + +class CreatePlanPriceRequest(BaseModel): + r"""Base recurring price for the plan. Omit for free or usage-only plans.""" + + amount: float + r"""Base price amount for the plan.""" + + interval: CreatePlanPriceIntervalRequest + r"""Billing interval (e.g. 'month', 'year').""" + + interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +CreatePlanResetIntervalRequest = Literal[ + "one_off", + "minute", + "hour", + "day", + "week", + "month", + "quarter", + "semi_annual", + "year", +] +r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" + + +class CreatePlanResetRequestTypedDict(TypedDict): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + interval: CreatePlanResetIntervalRequest + r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" + interval_count: NotRequired[float] + r"""Number of intervals between resets. Defaults to 1.""" + + +class CreatePlanResetRequest(BaseModel): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + interval: CreatePlanResetIntervalRequest + r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" + + interval_count: Optional[float] = None + r"""Number of intervals between resets. Defaults to 1.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +CreatePlanToRequestTypedDict = TypeAliasType( + "CreatePlanToRequestTypedDict", Union[float, str] +) + + +CreatePlanToRequest = TypeAliasType("CreatePlanToRequest", Union[float, str]) + + +class CreatePlanTierRequestTypedDict(TypedDict): + to: CreatePlanToRequestTypedDict + amount: float + + +class CreatePlanTierRequest(BaseModel): + to: CreatePlanToRequest + + amount: float + + +CreatePlanItemPriceIntervalRequest = Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", +] +r"""Billing interval. For consumable features, should match reset.interval.""" + + +CreatePlanBillingMethodRequest = Literal[ + "prepaid", + "usage_based", +] +r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" + + +class CreatePlanItemPriceRequestTypedDict(TypedDict): + r"""Pricing for usage beyond included units. Omit for free features.""" + + interval: CreatePlanItemPriceIntervalRequest + r"""Billing interval. For consumable features, should match reset.interval.""" + billing_method: CreatePlanBillingMethodRequest + r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" + amount: NotRequired[float] + r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required.""" + tiers: NotRequired[List[CreatePlanTierRequestTypedDict]] + r"""Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required.""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + billing_units: NotRequired[float] + r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).""" + max_purchase: NotRequired[float] + r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.""" + + +class CreatePlanItemPriceRequest(BaseModel): + r"""Pricing for usage beyond included units. Omit for free features.""" + + interval: CreatePlanItemPriceIntervalRequest + r"""Billing interval. For consumable features, should match reset.interval.""" + + billing_method: CreatePlanBillingMethodRequest + r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" + + amount: Optional[float] = None + r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required.""" + + tiers: Optional[List[CreatePlanTierRequest]] = None + r"""Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required.""" + + interval_count: Optional[float] = 1 + r"""Number of intervals per billing cycle. Defaults to 1.""" + + billing_units: Optional[float] = 1 + r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).""" + + max_purchase: Optional[float] = None + r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["amount", "tiers", "interval_count", "billing_units", "max_purchase"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +CreatePlanOnIncrease = Literal[ + "bill_immediately", + "prorate_immediately", + "prorate_next_cycle", + "bill_next_cycle", +] +r"""Billing behavior when quantity increases mid-cycle.""" + + +CreatePlanOnDecrease = Literal[ + "prorate", + "prorate_immediately", + "prorate_next_cycle", + "none", + "no_prorations", +] +r"""Credit behavior when quantity decreases mid-cycle.""" + + +class CreatePlanProrationTypedDict(TypedDict): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + on_increase: CreatePlanOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" + on_decrease: CreatePlanOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" + + +class CreatePlanProration(BaseModel): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + on_increase: CreatePlanOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" + + on_decrease: CreatePlanOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" + + +CreatePlanExpiryDurationTypeRequest = Literal[ + "month", + "forever", +] +r"""When rolled over units expire.""" + + +class CreatePlanRolloverRequestTypedDict(TypedDict): + r"""Rollover config for unused units. If set, unused included units carry over.""" + + expiry_duration_type: CreatePlanExpiryDurationTypeRequest + r"""When rolled over units expire.""" + max: NotRequired[float] + r"""Max rollover units. Omit for unlimited rollover.""" + expiry_duration_length: NotRequired[float] + r"""Number of periods before expiry.""" + + +class CreatePlanRolloverRequest(BaseModel): + r"""Rollover config for unused units. If set, unused included units carry over.""" + + expiry_duration_type: CreatePlanExpiryDurationTypeRequest + r"""When rolled over units expire.""" + + max: Optional[float] = None + r"""Max rollover units. Omit for unlimited rollover.""" + + expiry_duration_length: Optional[float] = None + r"""Number of periods before expiry.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["max", "expiry_duration_length"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class CreatePlanItemRequestTypedDict(TypedDict): + feature_id: str + r"""The ID of the feature to configure.""" + included: NotRequired[float] + r"""Number of free units included. Balance resets to this each interval for consumable features.""" + unlimited: NotRequired[bool] + r"""If true, customer has unlimited access to this feature.""" + reset: NotRequired[CreatePlanResetRequestTypedDict] + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + price: NotRequired[CreatePlanItemPriceRequestTypedDict] + r"""Pricing for usage beyond included units. Omit for free features.""" + proration: NotRequired[CreatePlanProrationTypedDict] + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + rollover: NotRequired[CreatePlanRolloverRequestTypedDict] + r"""Rollover config for unused units. If set, unused included units carry over.""" + + +class CreatePlanItemRequest(BaseModel): + feature_id: str + r"""The ID of the feature to configure.""" + + included: Optional[float] = None + r"""Number of free units included. Balance resets to this each interval for consumable features.""" + + unlimited: Optional[bool] = None + r"""If true, customer has unlimited access to this feature.""" + + reset: Optional[CreatePlanResetRequest] = None + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + price: Optional[CreatePlanItemPriceRequest] = None + r"""Pricing for usage beyond included units. Omit for free features.""" + + proration: Optional[CreatePlanProration] = None + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + rollover: Optional[CreatePlanRolloverRequest] = None + r"""Rollover config for unused units. If set, unused included units carry over.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["included", "unlimited", "reset", "price", "proration", "rollover"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +CreatePlanDurationTypeRequest = Literal[ + "day", + "month", + "year", +] +r"""Unit of time for the trial ('day', 'month', 'year').""" + + +class CreatePlanFreeTrialRequestTypedDict(TypedDict): + r"""Free trial configuration. Customers can try this plan before being charged.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + duration_type: NotRequired[CreatePlanDurationTypeRequest] + r"""Unit of time for the trial ('day', 'month', 'year').""" + card_required: NotRequired[bool] + r"""If true, payment method required to start trial. Customer is charged after trial ends.""" + + +class CreatePlanFreeTrialRequest(BaseModel): + r"""Free trial configuration. Customers can try this plan before being charged.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + + duration_type: Optional[CreatePlanDurationTypeRequest] = "month" + r"""Unit of time for the trial ('day', 'month', 'year').""" + + card_required: Optional[bool] = True + r"""If true, payment method required to start trial. Customer is charged after trial ends.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["duration_type", "card_required"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class CreatePlanParamsTypedDict(TypedDict): + plan_id: str + r"""The ID of the plan to create.""" + name: str + r"""Display name of the plan.""" + group: NotRequired[str] + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" + description: NotRequired[Nullable[str]] + r"""Optional description of the plan.""" + add_on: NotRequired[bool] + r"""If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group.""" + auto_enable: NotRequired[bool] + r"""If true, plan is automatically attached when a customer is created. Use for free tiers.""" + price: NotRequired[CreatePlanPriceRequestTypedDict] + r"""Base recurring price for the plan. Omit for free or usage-only plans.""" + items: NotRequired[List[CreatePlanItemRequestTypedDict]] + r"""Feature configurations for this plan. Each item defines included units, pricing, and reset behavior.""" + free_trial: NotRequired[CreatePlanFreeTrialRequestTypedDict] + r"""Free trial configuration. Customers can try this plan before being charged.""" + + +class CreatePlanParams(BaseModel): + plan_id: str + r"""The ID of the plan to create.""" + + name: str + r"""Display name of the plan.""" + + group: Optional[str] = "" + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" + + description: OptionalNullable[str] = UNSET + r"""Optional description of the plan.""" + + add_on: Optional[bool] = False + r"""If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group.""" + + auto_enable: Optional[bool] = False + r"""If true, plan is automatically attached when a customer is created. Use for free tiers.""" + + price: Optional[CreatePlanPriceRequest] = None + r"""Base recurring price for the plan. Omit for free or usage-only plans.""" + + items: Optional[List[CreatePlanItemRequest]] = None + r"""Feature configurations for this plan. Each item defines included units, pricing, and reset behavior.""" + + free_trial: Optional[CreatePlanFreeTrialRequest] = None + r"""Free trial configuration. Customers can try this plan before being charged.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "group", + "description", + "add_on", + "auto_enable", + "price", + "items", + "free_trial", + ] + ) + nullable_fields = set(["description"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +CreatePlanPriceIntervalResponse = Union[ + Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] +r"""Billing interval (e.g. 'month', 'year').""" + + +class CreatePlanPriceDisplayTypedDict(TypedDict): + r"""Display text for showing this price in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + secondary_text: NotRequired[str] + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + +class CreatePlanPriceDisplay(BaseModel): + r"""Display text for showing this price in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + + secondary_text: Optional[str] = None + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["secondary_text"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class CreatePlanPriceResponseTypedDict(TypedDict): + amount: float + r"""Base price amount for the plan.""" + interval: CreatePlanPriceIntervalResponse + r"""Billing interval (e.g. 'month', 'year').""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + display: NotRequired[CreatePlanPriceDisplayTypedDict] + r"""Display text for showing this price in pricing pages.""" + + +class CreatePlanPriceResponse(BaseModel): + amount: float + r"""Base price amount for the plan.""" + + interval: CreatePlanPriceIntervalResponse + r"""Billing interval (e.g. 'month', 'year').""" + + interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" + + display: Optional[CreatePlanPriceDisplay] = None + r"""Display text for showing this price in pricing pages.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count", "display"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +CreatePlanType = Union[ + Literal[ + "static", + "boolean", + "single_use", + "continuous_use", + "credit_system", + ], + UnrecognizedStr, +] +r"""The type of the feature""" + + +class CreatePlanFeatureDisplayTypedDict(TypedDict): + singular: str + r"""The singular display name for the feature.""" + plural: str + r"""The plural display name for the feature.""" + + +class CreatePlanFeatureDisplay(BaseModel): + singular: str + r"""The singular display name for the feature.""" + + plural: str + r"""The plural display name for the feature.""" + + +class CreatePlanCreditSchemaTypedDict(TypedDict): + metered_feature_id: str + r"""The ID of the metered feature (should be a single_use feature).""" + credit_cost: float + r"""The credit cost of the metered feature.""" + + +class CreatePlanCreditSchema(BaseModel): + metered_feature_id: str + r"""The ID of the metered feature (should be a single_use feature).""" + + credit_cost: float + r"""The credit cost of the metered feature.""" + + +class CreatePlanFeatureTypedDict(TypedDict): + r"""The full feature object if expanded.""" + + id: str + r"""The ID of the feature, used to refer to it in other API calls like /track or /check.""" + type: CreatePlanType + r"""The type of the feature""" + name: NotRequired[Nullable[str]] + r"""The name of the feature.""" + display: NotRequired[Nullable[CreatePlanFeatureDisplayTypedDict]] + r"""Singular and plural display names for the feature.""" + credit_schema: NotRequired[Nullable[List[CreatePlanCreditSchemaTypedDict]]] + r"""Credit cost schema for credit system features.""" + archived: NotRequired[Nullable[bool]] + r"""Whether or not the feature is archived.""" + + +class CreatePlanFeature(BaseModel): + r"""The full feature object if expanded.""" + + id: str + r"""The ID of the feature, used to refer to it in other API calls like /track or /check.""" + + type: CreatePlanType + r"""The type of the feature""" + + name: OptionalNullable[str] = UNSET + r"""The name of the feature.""" + + display: OptionalNullable[CreatePlanFeatureDisplay] = UNSET + r"""Singular and plural display names for the feature.""" + + credit_schema: OptionalNullable[List[CreatePlanCreditSchema]] = UNSET + r"""Credit cost schema for credit system features.""" + + archived: OptionalNullable[bool] = UNSET + r"""Whether or not the feature is archived.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["name", "display", "credit_schema", "archived"]) + nullable_fields = set(["name", "display", "credit_schema", "archived"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +CreatePlanResetIntervalResponse = Union[ + Literal[ + "one_off", + "minute", + "hour", + "day", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] +r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" + + +class CreatePlanResetResponseTypedDict(TypedDict): + interval: CreatePlanResetIntervalResponse + r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" + interval_count: NotRequired[float] + r"""Number of intervals between resets. Defaults to 1.""" + + +class CreatePlanResetResponse(BaseModel): + interval: CreatePlanResetIntervalResponse + r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" + + interval_count: Optional[float] = None + r"""Number of intervals between resets. Defaults to 1.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +CreatePlanToResponseTypedDict = TypeAliasType( + "CreatePlanToResponseTypedDict", Union[float, str] +) + + +CreatePlanToResponse = TypeAliasType("CreatePlanToResponse", Union[float, str]) + + +class CreatePlanTierResponseTypedDict(TypedDict): + to: CreatePlanToResponseTypedDict + amount: float + + +class CreatePlanTierResponse(BaseModel): + to: CreatePlanToResponse + + amount: float + + +CreatePlanPriceItemIntervalResponse = Union[ + Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] +r"""Billing interval for this price. For consumable features, should match reset.interval.""" + + +CreatePlanBillingMethodResponse = Union[ + Literal[ + "prepaid", + "usage_based", + ], + UnrecognizedStr, +] +r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" + + +class CreatePlanItemPriceResponseTypedDict(TypedDict): + interval: CreatePlanPriceItemIntervalResponse + r"""Billing interval for this price. For consumable features, should match reset.interval.""" + billing_units: float + r"""Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200).""" + billing_method: CreatePlanBillingMethodResponse + r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" + max_purchase: Nullable[float] + r"""Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.""" + amount: NotRequired[float] + r"""Price per billing_units after included usage is consumed. Mutually exclusive with tiers.""" + tiers: NotRequired[List[CreatePlanTierResponseTypedDict]] + r"""Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required.""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + + +class CreatePlanItemPriceResponse(BaseModel): + interval: CreatePlanPriceItemIntervalResponse + r"""Billing interval for this price. For consumable features, should match reset.interval.""" + + billing_units: float + r"""Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200).""" + + billing_method: CreatePlanBillingMethodResponse + r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" + + max_purchase: Nullable[float] + r"""Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.""" + + amount: Optional[float] = None + r"""Price per billing_units after included usage is consumed. Mutually exclusive with tiers.""" + + tiers: Optional[List[CreatePlanTierResponse]] = None + r"""Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required.""" + + interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["amount", "tiers", "interval_count"]) + nullable_fields = set(["max_purchase"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class CreatePlanItemDisplayTypedDict(TypedDict): + r"""Display text for showing this item in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + secondary_text: NotRequired[str] + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + +class CreatePlanItemDisplay(BaseModel): + r"""Display text for showing this item in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + + secondary_text: Optional[str] = None + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["secondary_text"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +CreatePlanExpiryDurationTypeResponse = Union[ + Literal[ + "month", + "forever", + ], + UnrecognizedStr, +] +r"""When rolled over units expire.""" + + +class CreatePlanRolloverResponseTypedDict(TypedDict): + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + max: Nullable[float] + r"""Maximum rollover units. Null for unlimited rollover.""" + expiry_duration_type: CreatePlanExpiryDurationTypeResponse + r"""When rolled over units expire.""" + expiry_duration_length: NotRequired[float] + r"""Number of periods before expiry.""" + + +class CreatePlanRolloverResponse(BaseModel): + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + max: Nullable[float] + r"""Maximum rollover units. Null for unlimited rollover.""" + + expiry_duration_type: CreatePlanExpiryDurationTypeResponse + r"""When rolled over units expire.""" + + expiry_duration_length: Optional[float] = None + r"""Number of periods before expiry.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["expiry_duration_length"]) + nullable_fields = set(["max"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class CreatePlanItemResponseTypedDict(TypedDict): + feature_id: str + r"""The ID of the feature this item configures.""" + included: float + r"""Number of free units included. For consumable features, balance resets to this number each interval.""" + unlimited: bool + r"""Whether the customer has unlimited access to this feature.""" + reset: Nullable[CreatePlanResetResponseTypedDict] + r"""Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.""" + price: Nullable[CreatePlanItemPriceResponseTypedDict] + r"""Pricing configuration for usage beyond included units. Null if feature is entirely free.""" + feature: NotRequired[CreatePlanFeatureTypedDict] + r"""The full feature object if expanded.""" + display: NotRequired[CreatePlanItemDisplayTypedDict] + r"""Display text for showing this item in pricing pages.""" + rollover: NotRequired[CreatePlanRolloverResponseTypedDict] + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + +class CreatePlanItemResponse(BaseModel): + feature_id: str + r"""The ID of the feature this item configures.""" + + included: float + r"""Number of free units included. For consumable features, balance resets to this number each interval.""" + + unlimited: bool + r"""Whether the customer has unlimited access to this feature.""" + + reset: Nullable[CreatePlanResetResponse] + r"""Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.""" + + price: Nullable[CreatePlanItemPriceResponse] + r"""Pricing configuration for usage beyond included units. Null if feature is entirely free.""" + + feature: Optional[CreatePlanFeature] = None + r"""The full feature object if expanded.""" + + display: Optional[CreatePlanItemDisplay] = None + r"""Display text for showing this item in pricing pages.""" + + rollover: Optional[CreatePlanRolloverResponse] = None + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["feature", "display", "rollover"]) + nullable_fields = set(["reset", "price"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +CreatePlanDurationTypeResponse = Union[ + Literal[ + "day", + "month", + "year", + ], + UnrecognizedStr, +] +r"""Unit of time for the trial duration ('day', 'month', 'year').""" + + +class CreatePlanFreeTrialResponseTypedDict(TypedDict): + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + duration_type: CreatePlanDurationTypeResponse + r"""Unit of time for the trial duration ('day', 'month', 'year').""" + card_required: bool + r"""Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.""" + + +class CreatePlanFreeTrialResponse(BaseModel): + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + + duration_type: CreatePlanDurationTypeResponse + r"""Unit of time for the trial duration ('day', 'month', 'year').""" + + card_required: bool + r"""Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.""" + + +CreatePlanEnv = Union[ + Literal[ + "sandbox", + "live", + ], + UnrecognizedStr, +] +r"""Environment this plan belongs to ('sandbox' or 'live').""" + + +class CreatePlanResponseTypedDict(TypedDict): + r"""A plan defines a set of features, pricing, and entitlements that can be attached to customers.""" + + id: str + r"""Unique identifier for the plan.""" + name: str + r"""Display name of the plan.""" + description: Nullable[str] + r"""Optional description of the plan.""" + group: Nullable[str] + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" + version: float + r"""Version number of the plan. Incremented when plan configuration changes.""" + add_on: bool + r"""Whether this is an add-on plan that can be attached alongside a main plan.""" + auto_enable: bool + r"""If true, this plan is automatically attached when a customer is created. Used for free plans.""" + price: Nullable[CreatePlanPriceResponseTypedDict] + r"""Base recurring price for the plan. Null for free plans or usage-only plans.""" + items: List[CreatePlanItemResponseTypedDict] + r"""Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.""" + created_at: float + r"""Unix timestamp (ms) when the plan was created.""" + env: CreatePlanEnv + r"""Environment this plan belongs to ('sandbox' or 'live').""" + archived: bool + r"""Whether the plan is archived. Archived plans cannot be attached to new customers.""" + base_variant_id: Nullable[str] + r"""If this is a variant, the ID of the base plan it was created from.""" + free_trial: NotRequired[CreatePlanFreeTrialResponseTypedDict] + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + +class CreatePlanResponse(BaseModel): + r"""A plan defines a set of features, pricing, and entitlements that can be attached to customers.""" + + id: str + r"""Unique identifier for the plan.""" + + name: str + r"""Display name of the plan.""" + + description: Nullable[str] + r"""Optional description of the plan.""" + + group: Nullable[str] + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" + + version: float + r"""Version number of the plan. Incremented when plan configuration changes.""" + + add_on: bool + r"""Whether this is an add-on plan that can be attached alongside a main plan.""" + + auto_enable: bool + r"""If true, this plan is automatically attached when a customer is created. Used for free plans.""" + + price: Nullable[CreatePlanPriceResponse] + r"""Base recurring price for the plan. Null for free plans or usage-only plans.""" + + items: List[CreatePlanItemResponse] + r"""Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.""" + + created_at: float + r"""Unix timestamp (ms) when the plan was created.""" + + env: CreatePlanEnv + r"""Environment this plan belongs to ('sandbox' or 'live').""" + + archived: bool + r"""Whether the plan is archived. Archived plans cannot be attached to new customers.""" + + base_variant_id: Nullable[str] + r"""If this is a variant, the ID of the base plan it was created from.""" + + free_trial: Optional[CreatePlanFreeTrialResponse] = None + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["free_trial"]) + nullable_fields = set(["description", "group", "price", "base_variant_id"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/others/python-sdk/src/autumn_sdk/models/deleteplanop.py b/others/python-sdk/src/autumn_sdk/models/deleteplanop.py new file mode 100644 index 000000000..e56bbf69c --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/deleteplanop.py @@ -0,0 +1,80 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from autumn_sdk.types import BaseModel, UNSET_SENTINEL +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeletePlanGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class DeletePlanGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class DeletePlanParamsTypedDict(TypedDict): + plan_id: str + r"""The ID of the plan to delete.""" + all_versions: NotRequired[bool] + r"""If true, deletes all versions of the plan. Otherwise, only deletes the latest version.""" + + +class DeletePlanParams(BaseModel): + plan_id: str + r"""The ID of the plan to delete.""" + + all_versions: Optional[bool] = False + r"""If true, deletes all versions of the plan. Otherwise, only deletes the latest version.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["all_versions"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class DeletePlanResponseTypedDict(TypedDict): + r"""OK""" + + success: bool + + +class DeletePlanResponse(BaseModel): + r"""OK""" + + success: bool diff --git a/others/python-sdk/src/autumn_sdk/models/getplanop.py b/others/python-sdk/src/autumn_sdk/models/getplanop.py new file mode 100644 index 000000000..9f3389434 --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/getplanop.py @@ -0,0 +1,739 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from autumn_sdk.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class GetPlanGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class GetPlanGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class GetPlanParamsTypedDict(TypedDict): + plan_id: str + r"""The ID of the plan to retrieve.""" + version: NotRequired[float] + r"""The version of the plan to get. Defaults to the latest version.""" + + +class GetPlanParams(BaseModel): + plan_id: str + r"""The ID of the plan to retrieve.""" + + version: Optional[float] = None + r"""The version of the plan to get. Defaults to the latest version.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +GetPlanPriceInterval = Union[ + Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] +r"""Billing interval (e.g. 'month', 'year').""" + + +class GetPlanPriceDisplayTypedDict(TypedDict): + r"""Display text for showing this price in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + secondary_text: NotRequired[str] + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + +class GetPlanPriceDisplay(BaseModel): + r"""Display text for showing this price in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + + secondary_text: Optional[str] = None + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["secondary_text"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class GetPlanPriceTypedDict(TypedDict): + amount: float + r"""Base price amount for the plan.""" + interval: GetPlanPriceInterval + r"""Billing interval (e.g. 'month', 'year').""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + display: NotRequired[GetPlanPriceDisplayTypedDict] + r"""Display text for showing this price in pricing pages.""" + + +class GetPlanPrice(BaseModel): + amount: float + r"""Base price amount for the plan.""" + + interval: GetPlanPriceInterval + r"""Billing interval (e.g. 'month', 'year').""" + + interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" + + display: Optional[GetPlanPriceDisplay] = None + r"""Display text for showing this price in pricing pages.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count", "display"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +GetPlanType = Union[ + Literal[ + "static", + "boolean", + "single_use", + "continuous_use", + "credit_system", + ], + UnrecognizedStr, +] +r"""The type of the feature""" + + +class GetPlanFeatureDisplayTypedDict(TypedDict): + singular: str + r"""The singular display name for the feature.""" + plural: str + r"""The plural display name for the feature.""" + + +class GetPlanFeatureDisplay(BaseModel): + singular: str + r"""The singular display name for the feature.""" + + plural: str + r"""The plural display name for the feature.""" + + +class GetPlanCreditSchemaTypedDict(TypedDict): + metered_feature_id: str + r"""The ID of the metered feature (should be a single_use feature).""" + credit_cost: float + r"""The credit cost of the metered feature.""" + + +class GetPlanCreditSchema(BaseModel): + metered_feature_id: str + r"""The ID of the metered feature (should be a single_use feature).""" + + credit_cost: float + r"""The credit cost of the metered feature.""" + + +class GetPlanFeatureTypedDict(TypedDict): + r"""The full feature object if expanded.""" + + id: str + r"""The ID of the feature, used to refer to it in other API calls like /track or /check.""" + type: GetPlanType + r"""The type of the feature""" + name: NotRequired[Nullable[str]] + r"""The name of the feature.""" + display: NotRequired[Nullable[GetPlanFeatureDisplayTypedDict]] + r"""Singular and plural display names for the feature.""" + credit_schema: NotRequired[Nullable[List[GetPlanCreditSchemaTypedDict]]] + r"""Credit cost schema for credit system features.""" + archived: NotRequired[Nullable[bool]] + r"""Whether or not the feature is archived.""" + + +class GetPlanFeature(BaseModel): + r"""The full feature object if expanded.""" + + id: str + r"""The ID of the feature, used to refer to it in other API calls like /track or /check.""" + + type: GetPlanType + r"""The type of the feature""" + + name: OptionalNullable[str] = UNSET + r"""The name of the feature.""" + + display: OptionalNullable[GetPlanFeatureDisplay] = UNSET + r"""Singular and plural display names for the feature.""" + + credit_schema: OptionalNullable[List[GetPlanCreditSchema]] = UNSET + r"""Credit cost schema for credit system features.""" + + archived: OptionalNullable[bool] = UNSET + r"""Whether or not the feature is archived.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["name", "display", "credit_schema", "archived"]) + nullable_fields = set(["name", "display", "credit_schema", "archived"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +GetPlanResetInterval = Union[ + Literal[ + "one_off", + "minute", + "hour", + "day", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] +r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" + + +class GetPlanResetTypedDict(TypedDict): + interval: GetPlanResetInterval + r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" + interval_count: NotRequired[float] + r"""Number of intervals between resets. Defaults to 1.""" + + +class GetPlanReset(BaseModel): + interval: GetPlanResetInterval + r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" + + interval_count: Optional[float] = None + r"""Number of intervals between resets. Defaults to 1.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +GetPlanToTypedDict = TypeAliasType("GetPlanToTypedDict", Union[float, str]) + + +GetPlanTo = TypeAliasType("GetPlanTo", Union[float, str]) + + +class GetPlanTierTypedDict(TypedDict): + to: GetPlanToTypedDict + amount: float + + +class GetPlanTier(BaseModel): + to: GetPlanTo + + amount: float + + +GetPlanPriceItemInterval = Union[ + Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] +r"""Billing interval for this price. For consumable features, should match reset.interval.""" + + +GetPlanBillingMethod = Union[ + Literal[ + "prepaid", + "usage_based", + ], + UnrecognizedStr, +] +r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" + + +class GetPlanItemPriceTypedDict(TypedDict): + interval: GetPlanPriceItemInterval + r"""Billing interval for this price. For consumable features, should match reset.interval.""" + billing_units: float + r"""Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200).""" + billing_method: GetPlanBillingMethod + r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" + max_purchase: Nullable[float] + r"""Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.""" + amount: NotRequired[float] + r"""Price per billing_units after included usage is consumed. Mutually exclusive with tiers.""" + tiers: NotRequired[List[GetPlanTierTypedDict]] + r"""Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required.""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + + +class GetPlanItemPrice(BaseModel): + interval: GetPlanPriceItemInterval + r"""Billing interval for this price. For consumable features, should match reset.interval.""" + + billing_units: float + r"""Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200).""" + + billing_method: GetPlanBillingMethod + r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" + + max_purchase: Nullable[float] + r"""Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.""" + + amount: Optional[float] = None + r"""Price per billing_units after included usage is consumed. Mutually exclusive with tiers.""" + + tiers: Optional[List[GetPlanTier]] = None + r"""Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required.""" + + interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["amount", "tiers", "interval_count"]) + nullable_fields = set(["max_purchase"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class GetPlanItemDisplayTypedDict(TypedDict): + r"""Display text for showing this item in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + secondary_text: NotRequired[str] + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + +class GetPlanItemDisplay(BaseModel): + r"""Display text for showing this item in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + + secondary_text: Optional[str] = None + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["secondary_text"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +GetPlanExpiryDurationType = Union[ + Literal[ + "month", + "forever", + ], + UnrecognizedStr, +] +r"""When rolled over units expire.""" + + +class GetPlanRolloverTypedDict(TypedDict): + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + max: Nullable[float] + r"""Maximum rollover units. Null for unlimited rollover.""" + expiry_duration_type: GetPlanExpiryDurationType + r"""When rolled over units expire.""" + expiry_duration_length: NotRequired[float] + r"""Number of periods before expiry.""" + + +class GetPlanRollover(BaseModel): + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + max: Nullable[float] + r"""Maximum rollover units. Null for unlimited rollover.""" + + expiry_duration_type: GetPlanExpiryDurationType + r"""When rolled over units expire.""" + + expiry_duration_length: Optional[float] = None + r"""Number of periods before expiry.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["expiry_duration_length"]) + nullable_fields = set(["max"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class GetPlanItemTypedDict(TypedDict): + feature_id: str + r"""The ID of the feature this item configures.""" + included: float + r"""Number of free units included. For consumable features, balance resets to this number each interval.""" + unlimited: bool + r"""Whether the customer has unlimited access to this feature.""" + reset: Nullable[GetPlanResetTypedDict] + r"""Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.""" + price: Nullable[GetPlanItemPriceTypedDict] + r"""Pricing configuration for usage beyond included units. Null if feature is entirely free.""" + feature: NotRequired[GetPlanFeatureTypedDict] + r"""The full feature object if expanded.""" + display: NotRequired[GetPlanItemDisplayTypedDict] + r"""Display text for showing this item in pricing pages.""" + rollover: NotRequired[GetPlanRolloverTypedDict] + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + +class GetPlanItem(BaseModel): + feature_id: str + r"""The ID of the feature this item configures.""" + + included: float + r"""Number of free units included. For consumable features, balance resets to this number each interval.""" + + unlimited: bool + r"""Whether the customer has unlimited access to this feature.""" + + reset: Nullable[GetPlanReset] + r"""Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.""" + + price: Nullable[GetPlanItemPrice] + r"""Pricing configuration for usage beyond included units. Null if feature is entirely free.""" + + feature: Optional[GetPlanFeature] = None + r"""The full feature object if expanded.""" + + display: Optional[GetPlanItemDisplay] = None + r"""Display text for showing this item in pricing pages.""" + + rollover: Optional[GetPlanRollover] = None + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["feature", "display", "rollover"]) + nullable_fields = set(["reset", "price"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +GetPlanDurationType = Union[ + Literal[ + "day", + "month", + "year", + ], + UnrecognizedStr, +] +r"""Unit of time for the trial duration ('day', 'month', 'year').""" + + +class GetPlanFreeTrialTypedDict(TypedDict): + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + duration_type: GetPlanDurationType + r"""Unit of time for the trial duration ('day', 'month', 'year').""" + card_required: bool + r"""Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.""" + + +class GetPlanFreeTrial(BaseModel): + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + + duration_type: GetPlanDurationType + r"""Unit of time for the trial duration ('day', 'month', 'year').""" + + card_required: bool + r"""Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.""" + + +GetPlanEnv = Union[ + Literal[ + "sandbox", + "live", + ], + UnrecognizedStr, +] +r"""Environment this plan belongs to ('sandbox' or 'live').""" + + +class GetPlanResponseTypedDict(TypedDict): + r"""A plan defines a set of features, pricing, and entitlements that can be attached to customers.""" + + id: str + r"""Unique identifier for the plan.""" + name: str + r"""Display name of the plan.""" + description: Nullable[str] + r"""Optional description of the plan.""" + group: Nullable[str] + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" + version: float + r"""Version number of the plan. Incremented when plan configuration changes.""" + add_on: bool + r"""Whether this is an add-on plan that can be attached alongside a main plan.""" + auto_enable: bool + r"""If true, this plan is automatically attached when a customer is created. Used for free plans.""" + price: Nullable[GetPlanPriceTypedDict] + r"""Base recurring price for the plan. Null for free plans or usage-only plans.""" + items: List[GetPlanItemTypedDict] + r"""Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.""" + created_at: float + r"""Unix timestamp (ms) when the plan was created.""" + env: GetPlanEnv + r"""Environment this plan belongs to ('sandbox' or 'live').""" + archived: bool + r"""Whether the plan is archived. Archived plans cannot be attached to new customers.""" + base_variant_id: Nullable[str] + r"""If this is a variant, the ID of the base plan it was created from.""" + free_trial: NotRequired[GetPlanFreeTrialTypedDict] + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + +class GetPlanResponse(BaseModel): + r"""A plan defines a set of features, pricing, and entitlements that can be attached to customers.""" + + id: str + r"""Unique identifier for the plan.""" + + name: str + r"""Display name of the plan.""" + + description: Nullable[str] + r"""Optional description of the plan.""" + + group: Nullable[str] + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" + + version: float + r"""Version number of the plan. Incremented when plan configuration changes.""" + + add_on: bool + r"""Whether this is an add-on plan that can be attached alongside a main plan.""" + + auto_enable: bool + r"""If true, this plan is automatically attached when a customer is created. Used for free plans.""" + + price: Nullable[GetPlanPrice] + r"""Base recurring price for the plan. Null for free plans or usage-only plans.""" + + items: List[GetPlanItem] + r"""Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.""" + + created_at: float + r"""Unix timestamp (ms) when the plan was created.""" + + env: GetPlanEnv + r"""Environment this plan belongs to ('sandbox' or 'live').""" + + archived: bool + r"""Whether the plan is archived. Archived plans cannot be attached to new customers.""" + + base_variant_id: Nullable[str] + r"""If this is a variant, the ID of the base plan it was created from.""" + + free_trial: Optional[GetPlanFreeTrial] = None + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["free_trial"]) + nullable_fields = set(["description", "group", "price", "base_variant_id"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/others/python-sdk/src/autumn_sdk/models/listplansop.py b/others/python-sdk/src/autumn_sdk/models/listplansop.py index 1a0a5ec5f..43c39a4af 100644 --- a/others/python-sdk/src/autumn_sdk/models/listplansop.py +++ b/others/python-sdk/src/autumn_sdk/models/listplansop.py @@ -1,13 +1,19 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .plan import Plan, PlanTypedDict -from autumn_sdk.types import BaseModel, UNSET_SENTINEL +from autumn_sdk.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) from autumn_sdk.utils import FieldMetadata, HeaderMetadata import pydantic from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict class ListPlansGlobalsTypedDict(TypedDict): @@ -38,18 +44,24 @@ class ListPlansGlobals(BaseModel): return m -class ListPlansRequestTypedDict(TypedDict): +class ListPlansParamsTypedDict(TypedDict): customer_id: NotRequired[str] + r"""Customer ID to include eligibility info (trial availability, attach scenario).""" entity_id: NotRequired[str] + r"""Entity ID for entity-scoped plans.""" include_archived: NotRequired[bool] + r"""If true, includes archived plans in the response.""" -class ListPlansRequest(BaseModel): +class ListPlansParams(BaseModel): customer_id: Optional[str] = None + r"""Customer ID to include eligibility info (trial availability, attach scenario).""" entity_id: Optional[str] = None + r"""Entity ID for entity-scoped plans.""" include_archived: Optional[bool] = None + r"""If true, includes archived plans in the response.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -68,13 +80,677 @@ class ListPlansRequest(BaseModel): return m +ListPlansPriceInterval = Union[ + Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] +r"""Billing interval (e.g. 'month', 'year').""" + + +class ListPlansPriceDisplayTypedDict(TypedDict): + r"""Display text for showing this price in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + secondary_text: NotRequired[str] + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + +class ListPlansPriceDisplay(BaseModel): + r"""Display text for showing this price in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + + secondary_text: Optional[str] = None + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["secondary_text"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListPlansPriceTypedDict(TypedDict): + amount: float + r"""Base price amount for the plan.""" + interval: ListPlansPriceInterval + r"""Billing interval (e.g. 'month', 'year').""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + display: NotRequired[ListPlansPriceDisplayTypedDict] + r"""Display text for showing this price in pricing pages.""" + + +class ListPlansPrice(BaseModel): + amount: float + r"""Base price amount for the plan.""" + + interval: ListPlansPriceInterval + r"""Billing interval (e.g. 'month', 'year').""" + + interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" + + display: Optional[ListPlansPriceDisplay] = None + r"""Display text for showing this price in pricing pages.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count", "display"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +ListPlansType = Union[ + Literal[ + "static", + "boolean", + "single_use", + "continuous_use", + "credit_system", + ], + UnrecognizedStr, +] +r"""The type of the feature""" + + +class ListPlansFeatureDisplayTypedDict(TypedDict): + singular: str + r"""The singular display name for the feature.""" + plural: str + r"""The plural display name for the feature.""" + + +class ListPlansFeatureDisplay(BaseModel): + singular: str + r"""The singular display name for the feature.""" + + plural: str + r"""The plural display name for the feature.""" + + +class ListPlansCreditSchemaTypedDict(TypedDict): + metered_feature_id: str + r"""The ID of the metered feature (should be a single_use feature).""" + credit_cost: float + r"""The credit cost of the metered feature.""" + + +class ListPlansCreditSchema(BaseModel): + metered_feature_id: str + r"""The ID of the metered feature (should be a single_use feature).""" + + credit_cost: float + r"""The credit cost of the metered feature.""" + + +class ListPlansFeatureTypedDict(TypedDict): + r"""The full feature object if expanded.""" + + id: str + r"""The ID of the feature, used to refer to it in other API calls like /track or /check.""" + type: ListPlansType + r"""The type of the feature""" + name: NotRequired[Nullable[str]] + r"""The name of the feature.""" + display: NotRequired[Nullable[ListPlansFeatureDisplayTypedDict]] + r"""Singular and plural display names for the feature.""" + credit_schema: NotRequired[Nullable[List[ListPlansCreditSchemaTypedDict]]] + r"""Credit cost schema for credit system features.""" + archived: NotRequired[Nullable[bool]] + r"""Whether or not the feature is archived.""" + + +class ListPlansFeature(BaseModel): + r"""The full feature object if expanded.""" + + id: str + r"""The ID of the feature, used to refer to it in other API calls like /track or /check.""" + + type: ListPlansType + r"""The type of the feature""" + + name: OptionalNullable[str] = UNSET + r"""The name of the feature.""" + + display: OptionalNullable[ListPlansFeatureDisplay] = UNSET + r"""Singular and plural display names for the feature.""" + + credit_schema: OptionalNullable[List[ListPlansCreditSchema]] = UNSET + r"""Credit cost schema for credit system features.""" + + archived: OptionalNullable[bool] = UNSET + r"""Whether or not the feature is archived.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["name", "display", "credit_schema", "archived"]) + nullable_fields = set(["name", "display", "credit_schema", "archived"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +ListPlansResetInterval = Union[ + Literal[ + "one_off", + "minute", + "hour", + "day", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] +r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" + + +class ListPlansResetTypedDict(TypedDict): + interval: ListPlansResetInterval + r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" + interval_count: NotRequired[float] + r"""Number of intervals between resets. Defaults to 1.""" + + +class ListPlansReset(BaseModel): + interval: ListPlansResetInterval + r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" + + interval_count: Optional[float] = None + r"""Number of intervals between resets. Defaults to 1.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +ListPlansToTypedDict = TypeAliasType("ListPlansToTypedDict", Union[float, str]) + + +ListPlansTo = TypeAliasType("ListPlansTo", Union[float, str]) + + +class ListPlansTierTypedDict(TypedDict): + to: ListPlansToTypedDict + amount: float + + +class ListPlansTier(BaseModel): + to: ListPlansTo + + amount: float + + +ListPlansPriceItemInterval = Union[ + Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] +r"""Billing interval for this price. For consumable features, should match reset.interval.""" + + +ListPlansBillingMethod = Union[ + Literal[ + "prepaid", + "usage_based", + ], + UnrecognizedStr, +] +r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" + + +class ListPlansItemPriceTypedDict(TypedDict): + interval: ListPlansPriceItemInterval + r"""Billing interval for this price. For consumable features, should match reset.interval.""" + billing_units: float + r"""Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200).""" + billing_method: ListPlansBillingMethod + r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" + max_purchase: Nullable[float] + r"""Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.""" + amount: NotRequired[float] + r"""Price per billing_units after included usage is consumed. Mutually exclusive with tiers.""" + tiers: NotRequired[List[ListPlansTierTypedDict]] + r"""Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required.""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + + +class ListPlansItemPrice(BaseModel): + interval: ListPlansPriceItemInterval + r"""Billing interval for this price. For consumable features, should match reset.interval.""" + + billing_units: float + r"""Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200).""" + + billing_method: ListPlansBillingMethod + r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" + + max_purchase: Nullable[float] + r"""Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.""" + + amount: Optional[float] = None + r"""Price per billing_units after included usage is consumed. Mutually exclusive with tiers.""" + + tiers: Optional[List[ListPlansTier]] = None + r"""Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required.""" + + interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["amount", "tiers", "interval_count"]) + nullable_fields = set(["max_purchase"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class ListPlansItemDisplayTypedDict(TypedDict): + r"""Display text for showing this item in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + secondary_text: NotRequired[str] + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + +class ListPlansItemDisplay(BaseModel): + r"""Display text for showing this item in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + + secondary_text: Optional[str] = None + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["secondary_text"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +ListPlansExpiryDurationType = Union[ + Literal[ + "month", + "forever", + ], + UnrecognizedStr, +] +r"""When rolled over units expire.""" + + +class ListPlansRolloverTypedDict(TypedDict): + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + max: Nullable[float] + r"""Maximum rollover units. Null for unlimited rollover.""" + expiry_duration_type: ListPlansExpiryDurationType + r"""When rolled over units expire.""" + expiry_duration_length: NotRequired[float] + r"""Number of periods before expiry.""" + + +class ListPlansRollover(BaseModel): + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + max: Nullable[float] + r"""Maximum rollover units. Null for unlimited rollover.""" + + expiry_duration_type: ListPlansExpiryDurationType + r"""When rolled over units expire.""" + + expiry_duration_length: Optional[float] = None + r"""Number of periods before expiry.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["expiry_duration_length"]) + nullable_fields = set(["max"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class ListPlansItemTypedDict(TypedDict): + feature_id: str + r"""The ID of the feature this item configures.""" + included: float + r"""Number of free units included. For consumable features, balance resets to this number each interval.""" + unlimited: bool + r"""Whether the customer has unlimited access to this feature.""" + reset: Nullable[ListPlansResetTypedDict] + r"""Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.""" + price: Nullable[ListPlansItemPriceTypedDict] + r"""Pricing configuration for usage beyond included units. Null if feature is entirely free.""" + feature: NotRequired[ListPlansFeatureTypedDict] + r"""The full feature object if expanded.""" + display: NotRequired[ListPlansItemDisplayTypedDict] + r"""Display text for showing this item in pricing pages.""" + rollover: NotRequired[ListPlansRolloverTypedDict] + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + +class ListPlansItem(BaseModel): + feature_id: str + r"""The ID of the feature this item configures.""" + + included: float + r"""Number of free units included. For consumable features, balance resets to this number each interval.""" + + unlimited: bool + r"""Whether the customer has unlimited access to this feature.""" + + reset: Nullable[ListPlansReset] + r"""Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.""" + + price: Nullable[ListPlansItemPrice] + r"""Pricing configuration for usage beyond included units. Null if feature is entirely free.""" + + feature: Optional[ListPlansFeature] = None + r"""The full feature object if expanded.""" + + display: Optional[ListPlansItemDisplay] = None + r"""Display text for showing this item in pricing pages.""" + + rollover: Optional[ListPlansRollover] = None + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["feature", "display", "rollover"]) + nullable_fields = set(["reset", "price"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +ListPlansDurationType = Union[ + Literal[ + "day", + "month", + "year", + ], + UnrecognizedStr, +] +r"""Unit of time for the trial duration ('day', 'month', 'year').""" + + +class ListPlansFreeTrialTypedDict(TypedDict): + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + duration_type: ListPlansDurationType + r"""Unit of time for the trial duration ('day', 'month', 'year').""" + card_required: bool + r"""Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.""" + + +class ListPlansFreeTrial(BaseModel): + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + + duration_type: ListPlansDurationType + r"""Unit of time for the trial duration ('day', 'month', 'year').""" + + card_required: bool + r"""Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.""" + + +ListPlansEnv = Union[ + Literal[ + "sandbox", + "live", + ], + UnrecognizedStr, +] +r"""Environment this plan belongs to ('sandbox' or 'live').""" + + +class ListPlansListTypedDict(TypedDict): + r"""A plan defines a set of features, pricing, and entitlements that can be attached to customers.""" + + id: str + r"""Unique identifier for the plan.""" + name: str + r"""Display name of the plan.""" + description: Nullable[str] + r"""Optional description of the plan.""" + group: Nullable[str] + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" + version: float + r"""Version number of the plan. Incremented when plan configuration changes.""" + add_on: bool + r"""Whether this is an add-on plan that can be attached alongside a main plan.""" + auto_enable: bool + r"""If true, this plan is automatically attached when a customer is created. Used for free plans.""" + price: Nullable[ListPlansPriceTypedDict] + r"""Base recurring price for the plan. Null for free plans or usage-only plans.""" + items: List[ListPlansItemTypedDict] + r"""Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.""" + created_at: float + r"""Unix timestamp (ms) when the plan was created.""" + env: ListPlansEnv + r"""Environment this plan belongs to ('sandbox' or 'live').""" + archived: bool + r"""Whether the plan is archived. Archived plans cannot be attached to new customers.""" + base_variant_id: Nullable[str] + r"""If this is a variant, the ID of the base plan it was created from.""" + free_trial: NotRequired[ListPlansFreeTrialTypedDict] + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + +class ListPlansList(BaseModel): + r"""A plan defines a set of features, pricing, and entitlements that can be attached to customers.""" + + id: str + r"""Unique identifier for the plan.""" + + name: str + r"""Display name of the plan.""" + + description: Nullable[str] + r"""Optional description of the plan.""" + + group: Nullable[str] + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" + + version: float + r"""Version number of the plan. Incremented when plan configuration changes.""" + + add_on: bool + r"""Whether this is an add-on plan that can be attached alongside a main plan.""" + + auto_enable: bool + r"""If true, this plan is automatically attached when a customer is created. Used for free plans.""" + + price: Nullable[ListPlansPrice] + r"""Base recurring price for the plan. Null for free plans or usage-only plans.""" + + items: List[ListPlansItem] + r"""Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.""" + + created_at: float + r"""Unix timestamp (ms) when the plan was created.""" + + env: ListPlansEnv + r"""Environment this plan belongs to ('sandbox' or 'live').""" + + archived: bool + r"""Whether the plan is archived. Archived plans cannot be attached to new customers.""" + + base_variant_id: Nullable[str] + r"""If this is a variant, the ID of the base plan it was created from.""" + + free_trial: Optional[ListPlansFreeTrial] = None + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["free_trial"]) + nullable_fields = set(["description", "group", "price", "base_variant_id"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + class ListPlansResponseTypedDict(TypedDict): r"""OK""" - list: List[PlanTypedDict] + list: List[ListPlansListTypedDict] class ListPlansResponse(BaseModel): r"""OK""" - list: List[Plan] + list: List[ListPlansList] diff --git a/others/python-sdk/src/autumn_sdk/models/plan.py b/others/python-sdk/src/autumn_sdk/models/plan.py index 19eb17355..76e8c1505 100644 --- a/others/python-sdk/src/autumn_sdk/models/plan.py +++ b/others/python-sdk/src/autumn_sdk/models/plan.py @@ -25,17 +25,26 @@ PlanPriceInterval = Union[ ], UnrecognizedStr, ] +r"""Billing interval (e.g. 'month', 'year').""" -class PriceDisplayTypedDict(TypedDict): +class PlanPriceDisplayTypedDict(TypedDict): + r"""Display text for showing this price in pricing pages.""" + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" secondary_text: NotRequired[str] + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" -class PriceDisplay(BaseModel): +class PlanPriceDisplay(BaseModel): + r"""Display text for showing this price in pricing pages.""" + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" secondary_text: Optional[str] = None + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -56,19 +65,27 @@ class PriceDisplay(BaseModel): class PlanPriceTypedDict(TypedDict): amount: float + r"""Base price amount for the plan.""" interval: PlanPriceInterval + r"""Billing interval (e.g. 'month', 'year').""" interval_count: NotRequired[float] - display: NotRequired[PriceDisplayTypedDict] + r"""Number of intervals per billing cycle. Defaults to 1.""" + display: NotRequired[PlanPriceDisplayTypedDict] + r"""Display text for showing this price in pricing pages.""" class PlanPrice(BaseModel): amount: float + r"""Base price amount for the plan.""" interval: PlanPriceInterval + r"""Billing interval (e.g. 'month', 'year').""" interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" - display: Optional[PriceDisplay] = None + display: Optional[PlanPriceDisplay] = None + r"""Display text for showing this price in pricing pages.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -131,6 +148,8 @@ class PlanCreditSchema(BaseModel): class PlanFeatureTypedDict(TypedDict): + r"""The full feature object if expanded.""" + id: str r"""The ID of the feature, used to refer to it in other API calls like /track or /check.""" type: PlanType @@ -146,6 +165,8 @@ class PlanFeatureTypedDict(TypedDict): class PlanFeature(BaseModel): + r"""The full feature object if expanded.""" + id: str r"""The ID of the feature, used to refer to it in other API calls like /track or /check.""" @@ -204,17 +225,22 @@ PlanResetInterval = Union[ ], UnrecognizedStr, ] +r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" class PlanResetTypedDict(TypedDict): interval: PlanResetInterval + r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" interval_count: NotRequired[float] + r"""Number of intervals between resets. Defaults to 1.""" class PlanReset(BaseModel): interval: PlanResetInterval + r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" interval_count: Optional[float] = None + r"""Number of intervals between resets. Defaults to 1.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -261,6 +287,7 @@ PlanPriceItemInterval = Union[ ], UnrecognizedStr, ] +r"""Billing interval for this price. For consumable features, should match reset.interval.""" PlanBillingMethod = Union[ @@ -270,32 +297,47 @@ PlanBillingMethod = Union[ ], UnrecognizedStr, ] +r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" class PlanItemPriceTypedDict(TypedDict): interval: PlanPriceItemInterval + r"""Billing interval for this price. For consumable features, should match reset.interval.""" billing_units: float + r"""Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200).""" billing_method: PlanBillingMethod + r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" max_purchase: Nullable[float] + r"""Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.""" amount: NotRequired[float] + r"""Price per billing_units after included usage is consumed. Mutually exclusive with tiers.""" tiers: NotRequired[List[PlanTierTypedDict]] + r"""Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required.""" interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" class PlanItemPrice(BaseModel): interval: PlanPriceItemInterval + r"""Billing interval for this price. For consumable features, should match reset.interval.""" billing_units: float + r"""Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200).""" billing_method: PlanBillingMethod + r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" max_purchase: Nullable[float] + r"""Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.""" amount: Optional[float] = None + r"""Price per billing_units after included usage is consumed. Mutually exclusive with tiers.""" tiers: Optional[List[PlanTier]] = None + r"""Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required.""" interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -324,14 +366,22 @@ class PlanItemPrice(BaseModel): class PlanItemDisplayTypedDict(TypedDict): + r"""Display text for showing this item in pricing pages.""" + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" secondary_text: NotRequired[str] + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" class PlanItemDisplay(BaseModel): + r"""Display text for showing this item in pricing pages.""" + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" secondary_text: Optional[str] = None + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -357,20 +407,31 @@ ExpiryDurationType = Union[ ], UnrecognizedStr, ] +r"""When rolled over units expire.""" class PlanRolloverTypedDict(TypedDict): + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + max: Nullable[float] + r"""Maximum rollover units. Null for unlimited rollover.""" expiry_duration_type: ExpiryDurationType + r"""When rolled over units expire.""" expiry_duration_length: NotRequired[float] + r"""Number of periods before expiry.""" class PlanRollover(BaseModel): + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + max: Nullable[float] + r"""Maximum rollover units. Null for unlimited rollover.""" expiry_duration_type: ExpiryDurationType + r"""When rolled over units expire.""" expiry_duration_length: Optional[float] = None + r"""Number of periods before expiry.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -398,90 +459,53 @@ class PlanRollover(BaseModel): return m -OnIncrease = Union[ - Literal[ - "bill_immediately", - "prorate_immediately", - "prorate_next_cycle", - "bill_next_cycle", - ], - UnrecognizedStr, -] - - -OnDecrease = Union[ - Literal[ - "prorate", - "prorate_immediately", - "prorate_next_cycle", - "none", - "no_prorations", - ], - UnrecognizedStr, -] - - -class ProrationTypedDict(TypedDict): - on_increase: NotRequired[OnIncrease] - on_decrease: NotRequired[OnDecrease] - - -class Proration(BaseModel): - on_increase: Optional[OnIncrease] = None - - on_decrease: Optional[OnDecrease] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["on_increase", "on_decrease"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - class ItemTypedDict(TypedDict): feature_id: str + r"""The ID of the feature this item configures.""" included: float + r"""Number of free units included. For consumable features, balance resets to this number each interval.""" unlimited: bool + r"""Whether the customer has unlimited access to this feature.""" reset: Nullable[PlanResetTypedDict] + r"""Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.""" price: Nullable[PlanItemPriceTypedDict] + r"""Pricing configuration for usage beyond included units. Null if feature is entirely free.""" feature: NotRequired[PlanFeatureTypedDict] + r"""The full feature object if expanded.""" display: NotRequired[PlanItemDisplayTypedDict] + r"""Display text for showing this item in pricing pages.""" rollover: NotRequired[PlanRolloverTypedDict] - proration: NotRequired[ProrationTypedDict] + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" class Item(BaseModel): feature_id: str + r"""The ID of the feature this item configures.""" included: float + r"""Number of free units included. For consumable features, balance resets to this number each interval.""" unlimited: bool + r"""Whether the customer has unlimited access to this feature.""" reset: Nullable[PlanReset] + r"""Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.""" price: Nullable[PlanItemPrice] + r"""Pricing configuration for usage beyond included units. Null if feature is entirely free.""" feature: Optional[PlanFeature] = None + r"""The full feature object if expanded.""" display: Optional[PlanItemDisplay] = None + r"""Display text for showing this item in pricing pages.""" rollover: Optional[PlanRollover] = None - - proration: Optional[Proration] = None + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["feature", "display", "rollover", "proration"]) + optional_fields = set(["feature", "display", "rollover"]) nullable_fields = set(["reset", "price"]) serialized = handler(self) m = {} @@ -513,20 +537,31 @@ PlanDurationType = Union[ ], UnrecognizedStr, ] +r"""Unit of time for the trial duration ('day', 'month', 'year').""" class FreeTrialTypedDict(TypedDict): + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + duration_length: float + r"""Number of duration_type periods the trial lasts.""" duration_type: PlanDurationType + r"""Unit of time for the trial duration ('day', 'month', 'year').""" card_required: bool + r"""Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.""" class FreeTrial(BaseModel): + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + duration_length: float + r"""Number of duration_type periods the trial lasts.""" duration_type: PlanDurationType + r"""Unit of time for the trial duration ('day', 'month', 'year').""" card_required: bool + r"""Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.""" PlanEnv = Union[ @@ -536,103 +571,86 @@ PlanEnv = Union[ ], UnrecognizedStr, ] - - -Scenario = Union[ - Literal[ - "scheduled", - "active", - "new", - "renew", - "upgrade", - "downgrade", - "cancel", - "expired", - "past_due", - ], - UnrecognizedStr, -] - - -class CustomerEligibilityTypedDict(TypedDict): - scenario: Scenario - trial_available: NotRequired[bool] - - -class CustomerEligibility(BaseModel): - scenario: Scenario - - trial_available: Optional[bool] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["trial_available"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m +r"""Environment this plan belongs to ('sandbox' or 'live').""" class PlanTypedDict(TypedDict): id: str + r"""Unique identifier for the plan.""" name: str + r"""Display name of the plan.""" description: Nullable[str] + r"""Optional description of the plan.""" group: Nullable[str] + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" version: float + r"""Version number of the plan. Incremented when plan configuration changes.""" add_on: bool + r"""Whether this is an add-on plan that can be attached alongside a main plan.""" auto_enable: bool + r"""If true, this plan is automatically attached when a customer is created. Used for free plans.""" price: Nullable[PlanPriceTypedDict] + r"""Base recurring price for the plan. Null for free plans or usage-only plans.""" items: List[ItemTypedDict] + r"""Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.""" created_at: float + r"""Unix timestamp (ms) when the plan was created.""" env: PlanEnv + r"""Environment this plan belongs to ('sandbox' or 'live').""" archived: bool + r"""Whether the plan is archived. Archived plans cannot be attached to new customers.""" base_variant_id: Nullable[str] + r"""If this is a variant, the ID of the base plan it was created from.""" free_trial: NotRequired[FreeTrialTypedDict] - customer_eligibility: NotRequired[CustomerEligibilityTypedDict] + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" class Plan(BaseModel): id: str + r"""Unique identifier for the plan.""" name: str + r"""Display name of the plan.""" description: Nullable[str] + r"""Optional description of the plan.""" group: Nullable[str] + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" version: float + r"""Version number of the plan. Incremented when plan configuration changes.""" add_on: bool + r"""Whether this is an add-on plan that can be attached alongside a main plan.""" auto_enable: bool + r"""If true, this plan is automatically attached when a customer is created. Used for free plans.""" price: Nullable[PlanPrice] + r"""Base recurring price for the plan. Null for free plans or usage-only plans.""" items: List[Item] + r"""Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.""" created_at: float + r"""Unix timestamp (ms) when the plan was created.""" env: PlanEnv + r"""Environment this plan belongs to ('sandbox' or 'live').""" archived: bool + r"""Whether the plan is archived. Archived plans cannot be attached to new customers.""" base_variant_id: Nullable[str] + r"""If this is a variant, the ID of the base plan it was created from.""" free_trial: Optional[FreeTrial] = None - - customer_eligibility: Optional[CustomerEligibility] = None + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["free_trial", "customer_eligibility"]) + optional_fields = set(["free_trial"]) nullable_fields = set(["description", "group", "price", "base_variant_id"]) serialized = handler(self) m = {} diff --git a/others/python-sdk/src/autumn_sdk/models/previewattachop.py b/others/python-sdk/src/autumn_sdk/models/previewattachop.py index 56792db8f..6826b9228 100644 --- a/others/python-sdk/src/autumn_sdk/models/previewattachop.py +++ b/others/python-sdk/src/autumn_sdk/models/previewattachop.py @@ -78,20 +78,27 @@ PreviewAttachDurationType = Literal[ "month", "year", ] +r"""Unit of time for the trial ('day', 'month', 'year').""" class PreviewAttachFreeTrialTypedDict(TypedDict): duration_length: float + r"""Number of duration_type periods the trial lasts.""" duration_type: NotRequired[PreviewAttachDurationType] + r"""Unit of time for the trial ('day', 'month', 'year').""" card_required: NotRequired[bool] + r"""If true, payment method required to start trial. Customer is charged after trial ends.""" class PreviewAttachFreeTrial(BaseModel): duration_length: float + r"""Number of duration_type periods the trial lasts.""" duration_type: Optional[PreviewAttachDurationType] = "month" + r"""Unit of time for the trial ('day', 'month', 'year').""" card_required: Optional[bool] = True + r"""If true, payment method required to start trial. Customer is charged after trial ends.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -118,20 +125,27 @@ PreviewAttachPriceInterval = Literal[ "semi_annual", "year", ] +r"""Billing interval (e.g. 'month', 'year').""" class PreviewAttachPriceTypedDict(TypedDict): amount: float + r"""Base price amount for the plan.""" interval: PreviewAttachPriceInterval + r"""Billing interval (e.g. 'month', 'year').""" interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" class PreviewAttachPrice(BaseModel): amount: float + r"""Base price amount for the plan.""" interval: PreviewAttachPriceInterval + r"""Billing interval (e.g. 'month', 'year').""" interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -161,17 +175,26 @@ PreviewAttachResetInterval = Literal[ "semi_annual", "year", ] +r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" class PreviewAttachResetTypedDict(TypedDict): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + interval: PreviewAttachResetInterval + r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" interval_count: NotRequired[float] + r"""Number of intervals between resets. Defaults to 1.""" class PreviewAttachReset(BaseModel): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + interval: PreviewAttachResetInterval + r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" interval_count: Optional[float] = None + r"""Number of intervals between resets. Defaults to 1.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -215,38 +238,58 @@ PreviewAttachItemPriceInterval = Literal[ "semi_annual", "year", ] +r"""Billing interval. For consumable features, should match reset.interval.""" PreviewAttachBillingMethod = Literal[ "prepaid", "usage_based", ] +r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" class PreviewAttachItemPriceTypedDict(TypedDict): + r"""Pricing for usage beyond included units. Omit for free features.""" + interval: PreviewAttachItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" billing_method: PreviewAttachBillingMethod + r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" amount: NotRequired[float] + r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required.""" tiers: NotRequired[List[PreviewAttachTierTypedDict]] + r"""Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required.""" interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: NotRequired[float] + r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).""" max_purchase: NotRequired[float] + r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.""" class PreviewAttachItemPrice(BaseModel): + r"""Pricing for usage beyond included units. Omit for free features.""" + interval: PreviewAttachItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" billing_method: PreviewAttachBillingMethod + r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" amount: Optional[float] = None + r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required.""" tiers: Optional[List[PreviewAttachTier]] = None + r"""Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required.""" interval_count: Optional[float] = 1 + r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: Optional[float] = 1 + r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).""" max_purchase: Optional[float] = None + r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -273,6 +316,7 @@ PreviewAttachOnIncrease = Literal[ "prorate_next_cycle", "bill_next_cycle", ] +r"""Billing behavior when quantity increases mid-cycle.""" PreviewAttachOnDecrease = Literal[ @@ -282,37 +326,57 @@ PreviewAttachOnDecrease = Literal[ "none", "no_prorations", ] +r"""Credit behavior when quantity decreases mid-cycle.""" class PreviewAttachProrationTypedDict(TypedDict): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + on_increase: PreviewAttachOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" on_decrease: PreviewAttachOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" class PreviewAttachProration(BaseModel): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + on_increase: PreviewAttachOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" on_decrease: PreviewAttachOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" PreviewAttachExpiryDurationType = Literal[ "month", "forever", ] +r"""When rolled over units expire.""" class PreviewAttachRolloverTypedDict(TypedDict): + r"""Rollover config for unused units. If set, unused included units carry over.""" + expiry_duration_type: PreviewAttachExpiryDurationType + r"""When rolled over units expire.""" max: NotRequired[float] + r"""Max rollover units. Omit for unlimited rollover.""" expiry_duration_length: NotRequired[float] + r"""Number of periods before expiry.""" class PreviewAttachRollover(BaseModel): + r"""Rollover config for unused units. If set, unused included units carry over.""" + expiry_duration_type: PreviewAttachExpiryDurationType + r"""When rolled over units expire.""" max: Optional[float] = None + r"""Max rollover units. Omit for unlimited rollover.""" expiry_duration_length: Optional[float] = None + r"""Number of periods before expiry.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -333,28 +397,42 @@ class PreviewAttachRollover(BaseModel): class PreviewAttachItemTypedDict(TypedDict): feature_id: str + r"""The ID of the feature to configure.""" included: NotRequired[float] + r"""Number of free units included. Balance resets to this each interval for consumable features.""" unlimited: NotRequired[bool] + r"""If true, customer has unlimited access to this feature.""" reset: NotRequired[PreviewAttachResetTypedDict] + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" price: NotRequired[PreviewAttachItemPriceTypedDict] + r"""Pricing for usage beyond included units. Omit for free features.""" proration: NotRequired[PreviewAttachProrationTypedDict] + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" rollover: NotRequired[PreviewAttachRolloverTypedDict] + r"""Rollover config for unused units. If set, unused included units carry over.""" class PreviewAttachItem(BaseModel): feature_id: str + r"""The ID of the feature to configure.""" included: Optional[float] = None + r"""Number of free units included. Balance resets to this each interval for consumable features.""" unlimited: Optional[bool] = None + r"""If true, customer has unlimited access to this feature.""" reset: Optional[PreviewAttachReset] = None + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" price: Optional[PreviewAttachItemPrice] = None + r"""Pricing for usage beyond included units. Omit for free features.""" proration: Optional[PreviewAttachProration] = None + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" rollover: Optional[PreviewAttachRollover] = None + r"""Rollover config for unused units. If set, unused included units carry over.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/others/python-sdk/src/autumn_sdk/models/previewupdateop.py b/others/python-sdk/src/autumn_sdk/models/previewupdateop.py index a313a711b..486da27a3 100644 --- a/others/python-sdk/src/autumn_sdk/models/previewupdateop.py +++ b/others/python-sdk/src/autumn_sdk/models/previewupdateop.py @@ -78,20 +78,27 @@ PreviewUpdateDurationType = Literal[ "month", "year", ] +r"""Unit of time for the trial ('day', 'month', 'year').""" class PreviewUpdateFreeTrialTypedDict(TypedDict): duration_length: float + r"""Number of duration_type periods the trial lasts.""" duration_type: NotRequired[PreviewUpdateDurationType] + r"""Unit of time for the trial ('day', 'month', 'year').""" card_required: NotRequired[bool] + r"""If true, payment method required to start trial. Customer is charged after trial ends.""" class PreviewUpdateFreeTrial(BaseModel): duration_length: float + r"""Number of duration_type periods the trial lasts.""" duration_type: Optional[PreviewUpdateDurationType] = "month" + r"""Unit of time for the trial ('day', 'month', 'year').""" card_required: Optional[bool] = True + r"""If true, payment method required to start trial. Customer is charged after trial ends.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -118,20 +125,27 @@ PreviewUpdatePriceInterval = Literal[ "semi_annual", "year", ] +r"""Billing interval (e.g. 'month', 'year').""" class PreviewUpdatePriceTypedDict(TypedDict): amount: float + r"""Base price amount for the plan.""" interval: PreviewUpdatePriceInterval + r"""Billing interval (e.g. 'month', 'year').""" interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" class PreviewUpdatePrice(BaseModel): amount: float + r"""Base price amount for the plan.""" interval: PreviewUpdatePriceInterval + r"""Billing interval (e.g. 'month', 'year').""" interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -161,17 +175,26 @@ PreviewUpdateResetInterval = Literal[ "semi_annual", "year", ] +r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" class PreviewUpdateResetTypedDict(TypedDict): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + interval: PreviewUpdateResetInterval + r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" interval_count: NotRequired[float] + r"""Number of intervals between resets. Defaults to 1.""" class PreviewUpdateReset(BaseModel): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + interval: PreviewUpdateResetInterval + r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" interval_count: Optional[float] = None + r"""Number of intervals between resets. Defaults to 1.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -215,38 +238,58 @@ PreviewUpdateItemPriceInterval = Literal[ "semi_annual", "year", ] +r"""Billing interval. For consumable features, should match reset.interval.""" PreviewUpdateBillingMethod = Literal[ "prepaid", "usage_based", ] +r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" class PreviewUpdateItemPriceTypedDict(TypedDict): + r"""Pricing for usage beyond included units. Omit for free features.""" + interval: PreviewUpdateItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" billing_method: PreviewUpdateBillingMethod + r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" amount: NotRequired[float] + r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required.""" tiers: NotRequired[List[PreviewUpdateTierTypedDict]] + r"""Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required.""" interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: NotRequired[float] + r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).""" max_purchase: NotRequired[float] + r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.""" class PreviewUpdateItemPrice(BaseModel): + r"""Pricing for usage beyond included units. Omit for free features.""" + interval: PreviewUpdateItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" billing_method: PreviewUpdateBillingMethod + r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" amount: Optional[float] = None + r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required.""" tiers: Optional[List[PreviewUpdateTier]] = None + r"""Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required.""" interval_count: Optional[float] = 1 + r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: Optional[float] = 1 + r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).""" max_purchase: Optional[float] = None + r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -273,6 +316,7 @@ PreviewUpdateOnIncrease = Literal[ "prorate_next_cycle", "bill_next_cycle", ] +r"""Billing behavior when quantity increases mid-cycle.""" PreviewUpdateOnDecrease = Literal[ @@ -282,37 +326,57 @@ PreviewUpdateOnDecrease = Literal[ "none", "no_prorations", ] +r"""Credit behavior when quantity decreases mid-cycle.""" class PreviewUpdateProrationTypedDict(TypedDict): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + on_increase: PreviewUpdateOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" on_decrease: PreviewUpdateOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" class PreviewUpdateProration(BaseModel): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + on_increase: PreviewUpdateOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" on_decrease: PreviewUpdateOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" PreviewUpdateExpiryDurationType = Literal[ "month", "forever", ] +r"""When rolled over units expire.""" class PreviewUpdateRolloverTypedDict(TypedDict): + r"""Rollover config for unused units. If set, unused included units carry over.""" + expiry_duration_type: PreviewUpdateExpiryDurationType + r"""When rolled over units expire.""" max: NotRequired[float] + r"""Max rollover units. Omit for unlimited rollover.""" expiry_duration_length: NotRequired[float] + r"""Number of periods before expiry.""" class PreviewUpdateRollover(BaseModel): + r"""Rollover config for unused units. If set, unused included units carry over.""" + expiry_duration_type: PreviewUpdateExpiryDurationType + r"""When rolled over units expire.""" max: Optional[float] = None + r"""Max rollover units. Omit for unlimited rollover.""" expiry_duration_length: Optional[float] = None + r"""Number of periods before expiry.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -333,28 +397,42 @@ class PreviewUpdateRollover(BaseModel): class PreviewUpdateItemTypedDict(TypedDict): feature_id: str + r"""The ID of the feature to configure.""" included: NotRequired[float] + r"""Number of free units included. Balance resets to this each interval for consumable features.""" unlimited: NotRequired[bool] + r"""If true, customer has unlimited access to this feature.""" reset: NotRequired[PreviewUpdateResetTypedDict] + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" price: NotRequired[PreviewUpdateItemPriceTypedDict] + r"""Pricing for usage beyond included units. Omit for free features.""" proration: NotRequired[PreviewUpdateProrationTypedDict] + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" rollover: NotRequired[PreviewUpdateRolloverTypedDict] + r"""Rollover config for unused units. If set, unused included units carry over.""" class PreviewUpdateItem(BaseModel): feature_id: str + r"""The ID of the feature to configure.""" included: Optional[float] = None + r"""Number of free units included. Balance resets to this each interval for consumable features.""" unlimited: Optional[bool] = None + r"""If true, customer has unlimited access to this feature.""" reset: Optional[PreviewUpdateReset] = None + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" price: Optional[PreviewUpdateItemPrice] = None + r"""Pricing for usage beyond included units. Omit for free features.""" proration: Optional[PreviewUpdateProration] = None + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" rollover: Optional[PreviewUpdateRollover] = None + r"""Rollover config for unused units. If set, unused included units carry over.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/others/python-sdk/src/autumn_sdk/models/setuppaymentop.py b/others/python-sdk/src/autumn_sdk/models/setuppaymentop.py new file mode 100644 index 000000000..9ae3881ae --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/setuppaymentop.py @@ -0,0 +1,100 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .customerdata import CustomerData, CustomerDataTypedDict +from autumn_sdk.types import BaseModel, UNSET_SENTINEL +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Any, Dict, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class SetupPaymentGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class SetupPaymentGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class SetupPaymentParamsTypedDict(TypedDict): + customer_id: str + r"""The ID of the customer""" + success_url: NotRequired[str] + r"""URL to redirect to after successful payment setup. Must start with either http:// or https://""" + customer_data: NotRequired[CustomerDataTypedDict] + r"""Customer details to set when creating a customer""" + checkout_session_params: NotRequired[Dict[str, Any]] + r"""Additional parameters for the checkout session""" + + +class SetupPaymentParams(BaseModel): + customer_id: str + r"""The ID of the customer""" + + success_url: Optional[str] = None + r"""URL to redirect to after successful payment setup. Must start with either http:// or https://""" + + customer_data: Optional[CustomerData] = None + r"""Customer details to set when creating a customer""" + + checkout_session_params: Optional[Dict[str, Any]] = None + r"""Additional parameters for the checkout session""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["success_url", "customer_data", "checkout_session_params"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class SetupPaymentResponseTypedDict(TypedDict): + r"""OK""" + + customer_id: str + r"""The ID of the customer""" + url: str + r"""URL to the payment setup page""" + + +class SetupPaymentResponse(BaseModel): + r"""OK""" + + customer_id: str + r"""The ID of the customer""" + + url: str + r"""URL to the payment setup page""" diff --git a/others/python-sdk/src/autumn_sdk/models/updateplanop.py b/others/python-sdk/src/autumn_sdk/models/updateplanop.py new file mode 100644 index 000000000..1a4c78bee --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/updateplanop.py @@ -0,0 +1,1190 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from autumn_sdk.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class UpdatePlanGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class UpdatePlanGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +UpdatePlanPriceIntervalRequest = Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", +] +r"""Billing interval (e.g. 'month', 'year').""" + + +class UpdatePlanPriceRequestTypedDict(TypedDict): + amount: float + r"""Base price amount for the plan.""" + interval: UpdatePlanPriceIntervalRequest + r"""Billing interval (e.g. 'month', 'year').""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + + +class UpdatePlanPriceRequest(BaseModel): + amount: float + r"""Base price amount for the plan.""" + + interval: UpdatePlanPriceIntervalRequest + r"""Billing interval (e.g. 'month', 'year').""" + + interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +UpdatePlanResetIntervalRequest = Literal[ + "one_off", + "minute", + "hour", + "day", + "week", + "month", + "quarter", + "semi_annual", + "year", +] +r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" + + +class UpdatePlanResetRequestTypedDict(TypedDict): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + interval: UpdatePlanResetIntervalRequest + r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" + interval_count: NotRequired[float] + r"""Number of intervals between resets. Defaults to 1.""" + + +class UpdatePlanResetRequest(BaseModel): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + interval: UpdatePlanResetIntervalRequest + r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" + + interval_count: Optional[float] = None + r"""Number of intervals between resets. Defaults to 1.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +UpdatePlanToRequestTypedDict = TypeAliasType( + "UpdatePlanToRequestTypedDict", Union[float, str] +) + + +UpdatePlanToRequest = TypeAliasType("UpdatePlanToRequest", Union[float, str]) + + +class UpdatePlanTierRequestTypedDict(TypedDict): + to: UpdatePlanToRequestTypedDict + amount: float + + +class UpdatePlanTierRequest(BaseModel): + to: UpdatePlanToRequest + + amount: float + + +UpdatePlanItemPriceIntervalRequest = Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", +] +r"""Billing interval. For consumable features, should match reset.interval.""" + + +UpdatePlanBillingMethodRequest = Literal[ + "prepaid", + "usage_based", +] +r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" + + +class UpdatePlanItemPriceRequestTypedDict(TypedDict): + r"""Pricing for usage beyond included units. Omit for free features.""" + + interval: UpdatePlanItemPriceIntervalRequest + r"""Billing interval. For consumable features, should match reset.interval.""" + billing_method: UpdatePlanBillingMethodRequest + r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" + amount: NotRequired[float] + r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required.""" + tiers: NotRequired[List[UpdatePlanTierRequestTypedDict]] + r"""Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required.""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + billing_units: NotRequired[float] + r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).""" + max_purchase: NotRequired[float] + r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.""" + + +class UpdatePlanItemPriceRequest(BaseModel): + r"""Pricing for usage beyond included units. Omit for free features.""" + + interval: UpdatePlanItemPriceIntervalRequest + r"""Billing interval. For consumable features, should match reset.interval.""" + + billing_method: UpdatePlanBillingMethodRequest + r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" + + amount: Optional[float] = None + r"""Price per billing_units after included usage. Either 'amount' or 'tiers' is required.""" + + tiers: Optional[List[UpdatePlanTierRequest]] = None + r"""Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required.""" + + interval_count: Optional[float] = 1 + r"""Number of intervals per billing cycle. Defaults to 1.""" + + billing_units: Optional[float] = 1 + r"""Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).""" + + max_purchase: Optional[float] = None + r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["amount", "tiers", "interval_count", "billing_units", "max_purchase"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +UpdatePlanOnIncrease = Literal[ + "bill_immediately", + "prorate_immediately", + "prorate_next_cycle", + "bill_next_cycle", +] +r"""Billing behavior when quantity increases mid-cycle.""" + + +UpdatePlanOnDecrease = Literal[ + "prorate", + "prorate_immediately", + "prorate_next_cycle", + "none", + "no_prorations", +] +r"""Credit behavior when quantity decreases mid-cycle.""" + + +class UpdatePlanProrationTypedDict(TypedDict): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + on_increase: UpdatePlanOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" + on_decrease: UpdatePlanOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" + + +class UpdatePlanProration(BaseModel): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + on_increase: UpdatePlanOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" + + on_decrease: UpdatePlanOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" + + +UpdatePlanExpiryDurationTypeRequest = Literal[ + "month", + "forever", +] +r"""When rolled over units expire.""" + + +class UpdatePlanRolloverRequestTypedDict(TypedDict): + r"""Rollover config for unused units. If set, unused included units carry over.""" + + expiry_duration_type: UpdatePlanExpiryDurationTypeRequest + r"""When rolled over units expire.""" + max: NotRequired[float] + r"""Max rollover units. Omit for unlimited rollover.""" + expiry_duration_length: NotRequired[float] + r"""Number of periods before expiry.""" + + +class UpdatePlanRolloverRequest(BaseModel): + r"""Rollover config for unused units. If set, unused included units carry over.""" + + expiry_duration_type: UpdatePlanExpiryDurationTypeRequest + r"""When rolled over units expire.""" + + max: Optional[float] = None + r"""Max rollover units. Omit for unlimited rollover.""" + + expiry_duration_length: Optional[float] = None + r"""Number of periods before expiry.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["max", "expiry_duration_length"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class UpdatePlanItemRequestTypedDict(TypedDict): + feature_id: str + r"""The ID of the feature to configure.""" + included: NotRequired[float] + r"""Number of free units included. Balance resets to this each interval for consumable features.""" + unlimited: NotRequired[bool] + r"""If true, customer has unlimited access to this feature.""" + reset: NotRequired[UpdatePlanResetRequestTypedDict] + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + price: NotRequired[UpdatePlanItemPriceRequestTypedDict] + r"""Pricing for usage beyond included units. Omit for free features.""" + proration: NotRequired[UpdatePlanProrationTypedDict] + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + rollover: NotRequired[UpdatePlanRolloverRequestTypedDict] + r"""Rollover config for unused units. If set, unused included units carry over.""" + + +class UpdatePlanItemRequest(BaseModel): + feature_id: str + r"""The ID of the feature to configure.""" + + included: Optional[float] = None + r"""Number of free units included. Balance resets to this each interval for consumable features.""" + + unlimited: Optional[bool] = None + r"""If true, customer has unlimited access to this feature.""" + + reset: Optional[UpdatePlanResetRequest] = None + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + price: Optional[UpdatePlanItemPriceRequest] = None + r"""Pricing for usage beyond included units. Omit for free features.""" + + proration: Optional[UpdatePlanProration] = None + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + rollover: Optional[UpdatePlanRolloverRequest] = None + r"""Rollover config for unused units. If set, unused included units carry over.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["included", "unlimited", "reset", "price", "proration", "rollover"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +UpdatePlanDurationTypeRequest = Literal[ + "day", + "month", + "year", +] +r"""Unit of time for the trial ('day', 'month', 'year').""" + + +class UpdatePlanFreeTrialRequestTypedDict(TypedDict): + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + duration_type: NotRequired[UpdatePlanDurationTypeRequest] + r"""Unit of time for the trial ('day', 'month', 'year').""" + card_required: NotRequired[bool] + r"""If true, payment method required to start trial. Customer is charged after trial ends.""" + + +class UpdatePlanFreeTrialRequest(BaseModel): + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + + duration_type: Optional[UpdatePlanDurationTypeRequest] = "month" + r"""Unit of time for the trial ('day', 'month', 'year').""" + + card_required: Optional[bool] = True + r"""If true, payment method required to start trial. Customer is charged after trial ends.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["duration_type", "card_required"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class UpdatePlanParamsTypedDict(TypedDict): + plan_id: str + r"""The ID of the plan to update.""" + group: NotRequired[str] + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" + name: NotRequired[str] + r"""Display name of the plan.""" + description: NotRequired[str] + add_on: NotRequired[bool] + r"""Whether the plan is an add-on.""" + auto_enable: NotRequired[bool] + r"""Whether the plan is automatically enabled.""" + price: NotRequired[Nullable[UpdatePlanPriceRequestTypedDict]] + r"""The price of the plan. Set to null to remove the base price.""" + items: NotRequired[List[UpdatePlanItemRequestTypedDict]] + r"""Feature configurations for this plan. Each item defines included units, pricing, and reset behavior.""" + free_trial: NotRequired[Nullable[UpdatePlanFreeTrialRequestTypedDict]] + r"""The free trial of the plan. Set to null to remove the free trial.""" + version: NotRequired[float] + archived: NotRequired[bool] + new_plan_id: NotRequired[str] + r"""The new ID to use for the plan. Can only be updated if the plan has not been used by any customers.""" + + +class UpdatePlanParams(BaseModel): + plan_id: str + r"""The ID of the plan to update.""" + + group: Optional[str] = "" + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" + + name: Optional[str] = None + r"""Display name of the plan.""" + + description: Optional[str] = None + + add_on: Optional[bool] = None + r"""Whether the plan is an add-on.""" + + auto_enable: Optional[bool] = None + r"""Whether the plan is automatically enabled.""" + + price: OptionalNullable[UpdatePlanPriceRequest] = UNSET + r"""The price of the plan. Set to null to remove the base price.""" + + items: Optional[List[UpdatePlanItemRequest]] = None + r"""Feature configurations for this plan. Each item defines included units, pricing, and reset behavior.""" + + free_trial: OptionalNullable[UpdatePlanFreeTrialRequest] = UNSET + r"""The free trial of the plan. Set to null to remove the free trial.""" + + version: Optional[float] = None + + archived: Optional[bool] = False + + new_plan_id: Optional[str] = None + r"""The new ID to use for the plan. Can only be updated if the plan has not been used by any customers.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "group", + "name", + "description", + "add_on", + "auto_enable", + "price", + "items", + "free_trial", + "version", + "archived", + "new_plan_id", + ] + ) + nullable_fields = set(["price", "free_trial"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +UpdatePlanPriceIntervalResponse = Union[ + Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] +r"""Billing interval (e.g. 'month', 'year').""" + + +class UpdatePlanPriceDisplayTypedDict(TypedDict): + r"""Display text for showing this price in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + secondary_text: NotRequired[str] + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + +class UpdatePlanPriceDisplay(BaseModel): + r"""Display text for showing this price in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + + secondary_text: Optional[str] = None + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["secondary_text"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class UpdatePlanPriceResponseTypedDict(TypedDict): + amount: float + r"""Base price amount for the plan.""" + interval: UpdatePlanPriceIntervalResponse + r"""Billing interval (e.g. 'month', 'year').""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + display: NotRequired[UpdatePlanPriceDisplayTypedDict] + r"""Display text for showing this price in pricing pages.""" + + +class UpdatePlanPriceResponse(BaseModel): + amount: float + r"""Base price amount for the plan.""" + + interval: UpdatePlanPriceIntervalResponse + r"""Billing interval (e.g. 'month', 'year').""" + + interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" + + display: Optional[UpdatePlanPriceDisplay] = None + r"""Display text for showing this price in pricing pages.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count", "display"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +UpdatePlanType = Union[ + Literal[ + "static", + "boolean", + "single_use", + "continuous_use", + "credit_system", + ], + UnrecognizedStr, +] +r"""The type of the feature""" + + +class UpdatePlanFeatureDisplayTypedDict(TypedDict): + singular: str + r"""The singular display name for the feature.""" + plural: str + r"""The plural display name for the feature.""" + + +class UpdatePlanFeatureDisplay(BaseModel): + singular: str + r"""The singular display name for the feature.""" + + plural: str + r"""The plural display name for the feature.""" + + +class UpdatePlanCreditSchemaTypedDict(TypedDict): + metered_feature_id: str + r"""The ID of the metered feature (should be a single_use feature).""" + credit_cost: float + r"""The credit cost of the metered feature.""" + + +class UpdatePlanCreditSchema(BaseModel): + metered_feature_id: str + r"""The ID of the metered feature (should be a single_use feature).""" + + credit_cost: float + r"""The credit cost of the metered feature.""" + + +class UpdatePlanFeatureTypedDict(TypedDict): + r"""The full feature object if expanded.""" + + id: str + r"""The ID of the feature, used to refer to it in other API calls like /track or /check.""" + type: UpdatePlanType + r"""The type of the feature""" + name: NotRequired[Nullable[str]] + r"""The name of the feature.""" + display: NotRequired[Nullable[UpdatePlanFeatureDisplayTypedDict]] + r"""Singular and plural display names for the feature.""" + credit_schema: NotRequired[Nullable[List[UpdatePlanCreditSchemaTypedDict]]] + r"""Credit cost schema for credit system features.""" + archived: NotRequired[Nullable[bool]] + r"""Whether or not the feature is archived.""" + + +class UpdatePlanFeature(BaseModel): + r"""The full feature object if expanded.""" + + id: str + r"""The ID of the feature, used to refer to it in other API calls like /track or /check.""" + + type: UpdatePlanType + r"""The type of the feature""" + + name: OptionalNullable[str] = UNSET + r"""The name of the feature.""" + + display: OptionalNullable[UpdatePlanFeatureDisplay] = UNSET + r"""Singular and plural display names for the feature.""" + + credit_schema: OptionalNullable[List[UpdatePlanCreditSchema]] = UNSET + r"""Credit cost schema for credit system features.""" + + archived: OptionalNullable[bool] = UNSET + r"""Whether or not the feature is archived.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["name", "display", "credit_schema", "archived"]) + nullable_fields = set(["name", "display", "credit_schema", "archived"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +UpdatePlanResetIntervalResponse = Union[ + Literal[ + "one_off", + "minute", + "hour", + "day", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] +r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" + + +class UpdatePlanResetResponseTypedDict(TypedDict): + interval: UpdatePlanResetIntervalResponse + r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" + interval_count: NotRequired[float] + r"""Number of intervals between resets. Defaults to 1.""" + + +class UpdatePlanResetResponse(BaseModel): + interval: UpdatePlanResetIntervalResponse + r"""The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.""" + + interval_count: Optional[float] = None + r"""Number of intervals between resets. Defaults to 1.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +UpdatePlanToResponseTypedDict = TypeAliasType( + "UpdatePlanToResponseTypedDict", Union[float, str] +) + + +UpdatePlanToResponse = TypeAliasType("UpdatePlanToResponse", Union[float, str]) + + +class UpdatePlanTierResponseTypedDict(TypedDict): + to: UpdatePlanToResponseTypedDict + amount: float + + +class UpdatePlanTierResponse(BaseModel): + to: UpdatePlanToResponse + + amount: float + + +UpdatePlanPriceItemIntervalResponse = Union[ + Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] +r"""Billing interval for this price. For consumable features, should match reset.interval.""" + + +UpdatePlanBillingMethodResponse = Union[ + Literal[ + "prepaid", + "usage_based", + ], + UnrecognizedStr, +] +r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" + + +class UpdatePlanItemPriceResponseTypedDict(TypedDict): + interval: UpdatePlanPriceItemIntervalResponse + r"""Billing interval for this price. For consumable features, should match reset.interval.""" + billing_units: float + r"""Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200).""" + billing_method: UpdatePlanBillingMethodResponse + r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" + max_purchase: Nullable[float] + r"""Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.""" + amount: NotRequired[float] + r"""Price per billing_units after included usage is consumed. Mutually exclusive with tiers.""" + tiers: NotRequired[List[UpdatePlanTierResponseTypedDict]] + r"""Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required.""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + + +class UpdatePlanItemPriceResponse(BaseModel): + interval: UpdatePlanPriceItemIntervalResponse + r"""Billing interval for this price. For consumable features, should match reset.interval.""" + + billing_units: float + r"""Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200).""" + + billing_method: UpdatePlanBillingMethodResponse + r"""'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.""" + + max_purchase: Nullable[float] + r"""Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.""" + + amount: Optional[float] = None + r"""Price per billing_units after included usage is consumed. Mutually exclusive with tiers.""" + + tiers: Optional[List[UpdatePlanTierResponse]] = None + r"""Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required.""" + + interval_count: Optional[float] = None + r"""Number of intervals per billing cycle. Defaults to 1.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["amount", "tiers", "interval_count"]) + nullable_fields = set(["max_purchase"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class UpdatePlanItemDisplayTypedDict(TypedDict): + r"""Display text for showing this item in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + secondary_text: NotRequired[str] + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + +class UpdatePlanItemDisplay(BaseModel): + r"""Display text for showing this item in pricing pages.""" + + primary_text: str + r"""Main display text (e.g. '$10' or '100 messages').""" + + secondary_text: Optional[str] = None + r"""Secondary display text (e.g. 'per month' or 'then $0.5 per 100').""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["secondary_text"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +UpdatePlanExpiryDurationTypeResponse = Union[ + Literal[ + "month", + "forever", + ], + UnrecognizedStr, +] +r"""When rolled over units expire.""" + + +class UpdatePlanRolloverResponseTypedDict(TypedDict): + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + max: Nullable[float] + r"""Maximum rollover units. Null for unlimited rollover.""" + expiry_duration_type: UpdatePlanExpiryDurationTypeResponse + r"""When rolled over units expire.""" + expiry_duration_length: NotRequired[float] + r"""Number of periods before expiry.""" + + +class UpdatePlanRolloverResponse(BaseModel): + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + max: Nullable[float] + r"""Maximum rollover units. Null for unlimited rollover.""" + + expiry_duration_type: UpdatePlanExpiryDurationTypeResponse + r"""When rolled over units expire.""" + + expiry_duration_length: Optional[float] = None + r"""Number of periods before expiry.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["expiry_duration_length"]) + nullable_fields = set(["max"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class UpdatePlanItemResponseTypedDict(TypedDict): + feature_id: str + r"""The ID of the feature this item configures.""" + included: float + r"""Number of free units included. For consumable features, balance resets to this number each interval.""" + unlimited: bool + r"""Whether the customer has unlimited access to this feature.""" + reset: Nullable[UpdatePlanResetResponseTypedDict] + r"""Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.""" + price: Nullable[UpdatePlanItemPriceResponseTypedDict] + r"""Pricing configuration for usage beyond included units. Null if feature is entirely free.""" + feature: NotRequired[UpdatePlanFeatureTypedDict] + r"""The full feature object if expanded.""" + display: NotRequired[UpdatePlanItemDisplayTypedDict] + r"""Display text for showing this item in pricing pages.""" + rollover: NotRequired[UpdatePlanRolloverResponseTypedDict] + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + +class UpdatePlanItemResponse(BaseModel): + feature_id: str + r"""The ID of the feature this item configures.""" + + included: float + r"""Number of free units included. For consumable features, balance resets to this number each interval.""" + + unlimited: bool + r"""Whether the customer has unlimited access to this feature.""" + + reset: Nullable[UpdatePlanResetResponse] + r"""Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.""" + + price: Nullable[UpdatePlanItemPriceResponse] + r"""Pricing configuration for usage beyond included units. Null if feature is entirely free.""" + + feature: Optional[UpdatePlanFeature] = None + r"""The full feature object if expanded.""" + + display: Optional[UpdatePlanItemDisplay] = None + r"""Display text for showing this item in pricing pages.""" + + rollover: Optional[UpdatePlanRolloverResponse] = None + r"""Rollover configuration for unused units. If set, unused included units roll over to the next period.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["feature", "display", "rollover"]) + nullable_fields = set(["reset", "price"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +UpdatePlanDurationTypeResponse = Union[ + Literal[ + "day", + "month", + "year", + ], + UnrecognizedStr, +] +r"""Unit of time for the trial duration ('day', 'month', 'year').""" + + +class UpdatePlanFreeTrialResponseTypedDict(TypedDict): + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + duration_type: UpdatePlanDurationTypeResponse + r"""Unit of time for the trial duration ('day', 'month', 'year').""" + card_required: bool + r"""Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.""" + + +class UpdatePlanFreeTrialResponse(BaseModel): + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + + duration_type: UpdatePlanDurationTypeResponse + r"""Unit of time for the trial duration ('day', 'month', 'year').""" + + card_required: bool + r"""Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.""" + + +UpdatePlanEnv = Union[ + Literal[ + "sandbox", + "live", + ], + UnrecognizedStr, +] +r"""Environment this plan belongs to ('sandbox' or 'live').""" + + +class UpdatePlanResponseTypedDict(TypedDict): + r"""A plan defines a set of features, pricing, and entitlements that can be attached to customers.""" + + id: str + r"""Unique identifier for the plan.""" + name: str + r"""Display name of the plan.""" + description: Nullable[str] + r"""Optional description of the plan.""" + group: Nullable[str] + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" + version: float + r"""Version number of the plan. Incremented when plan configuration changes.""" + add_on: bool + r"""Whether this is an add-on plan that can be attached alongside a main plan.""" + auto_enable: bool + r"""If true, this plan is automatically attached when a customer is created. Used for free plans.""" + price: Nullable[UpdatePlanPriceResponseTypedDict] + r"""Base recurring price for the plan. Null for free plans or usage-only plans.""" + items: List[UpdatePlanItemResponseTypedDict] + r"""Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.""" + created_at: float + r"""Unix timestamp (ms) when the plan was created.""" + env: UpdatePlanEnv + r"""Environment this plan belongs to ('sandbox' or 'live').""" + archived: bool + r"""Whether the plan is archived. Archived plans cannot be attached to new customers.""" + base_variant_id: Nullable[str] + r"""If this is a variant, the ID of the base plan it was created from.""" + free_trial: NotRequired[UpdatePlanFreeTrialResponseTypedDict] + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + +class UpdatePlanResponse(BaseModel): + r"""A plan defines a set of features, pricing, and entitlements that can be attached to customers.""" + + id: str + r"""Unique identifier for the plan.""" + + name: str + r"""Display name of the plan.""" + + description: Nullable[str] + r"""Optional description of the plan.""" + + group: Nullable[str] + r"""Group identifier for organizing related plans. Plans in the same group are mutually exclusive.""" + + version: float + r"""Version number of the plan. Incremented when plan configuration changes.""" + + add_on: bool + r"""Whether this is an add-on plan that can be attached alongside a main plan.""" + + auto_enable: bool + r"""If true, this plan is automatically attached when a customer is created. Used for free plans.""" + + price: Nullable[UpdatePlanPriceResponse] + r"""Base recurring price for the plan. Null for free plans or usage-only plans.""" + + items: List[UpdatePlanItemResponse] + r"""Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.""" + + created_at: float + r"""Unix timestamp (ms) when the plan was created.""" + + env: UpdatePlanEnv + r"""Environment this plan belongs to ('sandbox' or 'live').""" + + archived: bool + r"""Whether the plan is archived. Archived plans cannot be attached to new customers.""" + + base_variant_id: Nullable[str] + r"""If this is a variant, the ID of the base plan it was created from.""" + + free_trial: Optional[UpdatePlanFreeTrialResponse] = None + r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["free_trial"]) + nullable_fields = set(["description", "group", "price", "base_variant_id"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/others/python-sdk/src/autumn_sdk/plans.py b/others/python-sdk/src/autumn_sdk/plans.py index 6c6291f7c..95f31b5ba 100644 --- a/others/python-sdk/src/autumn_sdk/plans.py +++ b/others/python-sdk/src/autumn_sdk/plans.py @@ -5,15 +5,481 @@ from autumn_sdk import errors, models, utils from autumn_sdk._hooks import HookContext from autumn_sdk.types import BaseModel, OptionalNullable, UNSET from autumn_sdk.utils.unmarshal_json_response import unmarshal_json_response -from typing import Mapping, Optional, Union, cast +from typing import List, Mapping, Optional, Union, cast class Plans(BaseSDK): + def create( + self, + *, + plan_id: str, + name: str, + group: Optional[str] = "", + description: OptionalNullable[str] = UNSET, + add_on: Optional[bool] = False, + auto_enable: Optional[bool] = False, + price: Optional[ + Union[models.CreatePlanPriceRequest, models.CreatePlanPriceRequestTypedDict] + ] = None, + items: Optional[ + Union[ + List[models.CreatePlanItemRequest], + List[models.CreatePlanItemRequestTypedDict], + ] + ] = None, + free_trial: Optional[ + Union[ + models.CreatePlanFreeTrialRequest, + models.CreatePlanFreeTrialRequestTypedDict, + ] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.CreatePlanResponse: + r"""Create a plan + + Creates a new plan with optional base price and feature configurations. + + Use this to programmatically create pricing plans. See [How plans work](/documentation/pricing/plans) for concepts. + + :param plan_id: The ID of the plan to create. + :param name: Display name of the plan. + :param group: Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + :param description: Optional description of the plan. + :param add_on: If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. + :param auto_enable: If true, plan is automatically attached when a customer is created. Use for free tiers. + :param price: Base recurring price for the plan. Omit for free or usage-only plans. + :param items: Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. + :param free_trial: Free trial configuration. Customers can try this plan before being charged. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.CreatePlanParams( + plan_id=plan_id, + group=group, + name=name, + description=description, + add_on=add_on, + auto_enable=auto_enable, + price=utils.get_pydantic_model( + price, Optional[models.CreatePlanPriceRequest] + ), + items=utils.get_pydantic_model( + items, Optional[List[models.CreatePlanItemRequest]] + ), + free_trial=utils.get_pydantic_model( + free_trial, Optional[models.CreatePlanFreeTrialRequest] + ), + ) + + req = self._build_request( + method="POST", + path="/v1/plans.create", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.CreatePlanGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.CreatePlanParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createPlan", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CreatePlanResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def create_async( + self, + *, + plan_id: str, + name: str, + group: Optional[str] = "", + description: OptionalNullable[str] = UNSET, + add_on: Optional[bool] = False, + auto_enable: Optional[bool] = False, + price: Optional[ + Union[models.CreatePlanPriceRequest, models.CreatePlanPriceRequestTypedDict] + ] = None, + items: Optional[ + Union[ + List[models.CreatePlanItemRequest], + List[models.CreatePlanItemRequestTypedDict], + ] + ] = None, + free_trial: Optional[ + Union[ + models.CreatePlanFreeTrialRequest, + models.CreatePlanFreeTrialRequestTypedDict, + ] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.CreatePlanResponse: + r"""Create a plan + + Creates a new plan with optional base price and feature configurations. + + Use this to programmatically create pricing plans. See [How plans work](/documentation/pricing/plans) for concepts. + + :param plan_id: The ID of the plan to create. + :param name: Display name of the plan. + :param group: Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + :param description: Optional description of the plan. + :param add_on: If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. + :param auto_enable: If true, plan is automatically attached when a customer is created. Use for free tiers. + :param price: Base recurring price for the plan. Omit for free or usage-only plans. + :param items: Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. + :param free_trial: Free trial configuration. Customers can try this plan before being charged. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.CreatePlanParams( + plan_id=plan_id, + group=group, + name=name, + description=description, + add_on=add_on, + auto_enable=auto_enable, + price=utils.get_pydantic_model( + price, Optional[models.CreatePlanPriceRequest] + ), + items=utils.get_pydantic_model( + items, Optional[List[models.CreatePlanItemRequest]] + ), + free_trial=utils.get_pydantic_model( + free_trial, Optional[models.CreatePlanFreeTrialRequest] + ), + ) + + req = self._build_request_async( + method="POST", + path="/v1/plans.create", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.CreatePlanGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.CreatePlanParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createPlan", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CreatePlanResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + def get( + self, + *, + plan_id: str, + version: Optional[float] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.GetPlanResponse: + r"""Get a plan + + Retrieves a single plan by its ID. + + Use this to fetch the full configuration of a specific plan, including its features and pricing. + + :param plan_id: The ID of the plan to retrieve. + :param version: The version of the plan to get. Defaults to the latest version. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.GetPlanParams( + plan_id=plan_id, + version=version, + ) + + req = self._build_request( + method="POST", + path="/v1/plans.get", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.GetPlanGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.GetPlanParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getPlan", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.GetPlanResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def get_async( + self, + *, + plan_id: str, + version: Optional[float] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.GetPlanResponse: + r"""Get a plan + + Retrieves a single plan by its ID. + + Use this to fetch the full configuration of a specific plan, including its features and pricing. + + :param plan_id: The ID of the plan to retrieve. + :param version: The version of the plan to get. Defaults to the latest version. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.GetPlanParams( + plan_id=plan_id, + version=version, + ) + + req = self._build_request_async( + method="POST", + path="/v1/plans.get", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.GetPlanGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.GetPlanParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getPlan", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.GetPlanResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + def list( self, *, request: Optional[ - Union[models.ListPlansRequest, models.ListPlansRequestTypedDict] + Union[models.ListPlansParams, models.ListPlansParamsTypedDict] ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -22,6 +488,10 @@ class Plans(BaseSDK): ) -> models.ListPlansResponse: r"""List all plans + Lists all plans in the current environment. + + Use this to retrieve all plans for displaying pricing pages or managing plan configurations. + :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -39,8 +509,8 @@ class Plans(BaseSDK): base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): - request = utils.unmarshal(request, Optional[models.ListPlansRequest]) - request = cast(Optional[models.ListPlansRequest], request) + request = utils.unmarshal(request, Optional[models.ListPlansParams]) + request = cast(Optional[models.ListPlansParams], request) req = self._build_request( method="POST", @@ -59,7 +529,7 @@ class Plans(BaseSDK): ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, True, "json", Optional[models.ListPlansRequest] + request, False, True, "json", Optional[models.ListPlansParams] ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -105,7 +575,7 @@ class Plans(BaseSDK): self, *, request: Optional[ - Union[models.ListPlansRequest, models.ListPlansRequestTypedDict] + Union[models.ListPlansParams, models.ListPlansParamsTypedDict] ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -114,6 +584,10 @@ class Plans(BaseSDK): ) -> models.ListPlansResponse: r"""List all plans + Lists all plans in the current environment. + + Use this to retrieve all plans for displaying pricing pages or managing plan configurations. + :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -131,8 +605,8 @@ class Plans(BaseSDK): base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): - request = utils.unmarshal(request, Optional[models.ListPlansRequest]) - request = cast(Optional[models.ListPlansRequest], request) + request = utils.unmarshal(request, Optional[models.ListPlansParams]) + request = cast(Optional[models.ListPlansParams], request) req = self._build_request_async( method="POST", @@ -151,7 +625,7 @@ class Plans(BaseSDK): ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, True, "json", Optional[models.ListPlansRequest] + request, False, True, "json", Optional[models.ListPlansParams] ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -192,3 +666,487 @@ class Plans(BaseSDK): ) raise errors.AutumnDefaultError("Unexpected response received", http_res) + + def update( + self, + *, + plan_id: str, + group: Optional[str] = "", + name: Optional[str] = None, + description: Optional[str] = None, + add_on: Optional[bool] = None, + auto_enable: Optional[bool] = None, + price: OptionalNullable[ + Union[models.UpdatePlanPriceRequest, models.UpdatePlanPriceRequestTypedDict] + ] = UNSET, + items: Optional[ + Union[ + List[models.UpdatePlanItemRequest], + List[models.UpdatePlanItemRequestTypedDict], + ] + ] = None, + free_trial: OptionalNullable[ + Union[ + models.UpdatePlanFreeTrialRequest, + models.UpdatePlanFreeTrialRequestTypedDict, + ] + ] = UNSET, + version: Optional[float] = None, + archived: Optional[bool] = False, + new_plan_id: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.UpdatePlanResponse: + r"""Update a plan + + Updates an existing plan. Creates a new version unless `disableVersion` is set. + + Use this to modify plan properties, pricing, or feature configurations. See [Adding features to plans](/documentation/pricing/plan-features) for item configuration. + + :param plan_id: The ID of the plan to update. + :param group: Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + :param name: Display name of the plan. + :param description: + :param add_on: Whether the plan is an add-on. + :param auto_enable: Whether the plan is automatically enabled. + :param price: The price of the plan. Set to null to remove the base price. + :param items: Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. + :param free_trial: The free trial of the plan. Set to null to remove the free trial. + :param version: + :param archived: + :param new_plan_id: The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.UpdatePlanParams( + plan_id=plan_id, + group=group, + name=name, + description=description, + add_on=add_on, + auto_enable=auto_enable, + price=utils.get_pydantic_model( + price, OptionalNullable[models.UpdatePlanPriceRequest] + ), + items=utils.get_pydantic_model( + items, Optional[List[models.UpdatePlanItemRequest]] + ), + free_trial=utils.get_pydantic_model( + free_trial, OptionalNullable[models.UpdatePlanFreeTrialRequest] + ), + version=version, + archived=archived, + new_plan_id=new_plan_id, + ) + + req = self._build_request( + method="POST", + path="/v1/plans.update", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.UpdatePlanGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.UpdatePlanParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="updatePlan", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.UpdatePlanResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def update_async( + self, + *, + plan_id: str, + group: Optional[str] = "", + name: Optional[str] = None, + description: Optional[str] = None, + add_on: Optional[bool] = None, + auto_enable: Optional[bool] = None, + price: OptionalNullable[ + Union[models.UpdatePlanPriceRequest, models.UpdatePlanPriceRequestTypedDict] + ] = UNSET, + items: Optional[ + Union[ + List[models.UpdatePlanItemRequest], + List[models.UpdatePlanItemRequestTypedDict], + ] + ] = None, + free_trial: OptionalNullable[ + Union[ + models.UpdatePlanFreeTrialRequest, + models.UpdatePlanFreeTrialRequestTypedDict, + ] + ] = UNSET, + version: Optional[float] = None, + archived: Optional[bool] = False, + new_plan_id: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.UpdatePlanResponse: + r"""Update a plan + + Updates an existing plan. Creates a new version unless `disableVersion` is set. + + Use this to modify plan properties, pricing, or feature configurations. See [Adding features to plans](/documentation/pricing/plan-features) for item configuration. + + :param plan_id: The ID of the plan to update. + :param group: Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + :param name: Display name of the plan. + :param description: + :param add_on: Whether the plan is an add-on. + :param auto_enable: Whether the plan is automatically enabled. + :param price: The price of the plan. Set to null to remove the base price. + :param items: Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. + :param free_trial: The free trial of the plan. Set to null to remove the free trial. + :param version: + :param archived: + :param new_plan_id: The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.UpdatePlanParams( + plan_id=plan_id, + group=group, + name=name, + description=description, + add_on=add_on, + auto_enable=auto_enable, + price=utils.get_pydantic_model( + price, OptionalNullable[models.UpdatePlanPriceRequest] + ), + items=utils.get_pydantic_model( + items, Optional[List[models.UpdatePlanItemRequest]] + ), + free_trial=utils.get_pydantic_model( + free_trial, OptionalNullable[models.UpdatePlanFreeTrialRequest] + ), + version=version, + archived=archived, + new_plan_id=new_plan_id, + ) + + req = self._build_request_async( + method="POST", + path="/v1/plans.update", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.UpdatePlanGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.UpdatePlanParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="updatePlan", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.UpdatePlanResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + def delete( + self, + *, + plan_id: str, + all_versions: Optional[bool] = False, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.DeletePlanResponse: + r"""Delete a plan + + Deletes a plan by its ID. + + Use this to permanently remove a plan. Plans with active customers cannot be deleted - archive them instead. + + :param plan_id: The ID of the plan to delete. + :param all_versions: If true, deletes all versions of the plan. Otherwise, only deletes the latest version. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.DeletePlanParams( + plan_id=plan_id, + all_versions=all_versions, + ) + + req = self._build_request( + method="POST", + path="/v1/plans.delete", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.DeletePlanGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.DeletePlanParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deletePlan", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.DeletePlanResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def delete_async( + self, + *, + plan_id: str, + all_versions: Optional[bool] = False, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.DeletePlanResponse: + r"""Delete a plan + + Deletes a plan by its ID. + + Use this to permanently remove a plan. Plans with active customers cannot be deleted - archive them instead. + + :param plan_id: The ID of the plan to delete. + :param all_versions: If true, deletes all versions of the plan. Otherwise, only deletes the latest version. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.DeletePlanParams( + plan_id=plan_id, + all_versions=all_versions, + ) + + req = self._build_request_async( + method="POST", + path="/v1/plans.delete", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.DeletePlanGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.DeletePlanParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deletePlan", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.DeletePlanResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) diff --git a/others/python-sdk/uv.lock b/others/python-sdk/uv.lock index 0284cf310..3294c22de 100644 --- a/others/python-sdk/uv.lock +++ b/others/python-sdk/uv.lock @@ -44,7 +44,7 @@ wheels = [ [[package]] name = "autumn-sdk" -version = "0.4.8" +version = "0.4.15" source = { editable = "." } dependencies = [ { name = "httpcore" }, diff --git a/packages/autumn-js/src/backend/core/routes/routeConfigs.ts b/packages/autumn-js/src/backend/core/routes/routeConfigs.ts index e3938cfef..e0803d24e 100644 --- a/packages/autumn-js/src/backend/core/routes/routeConfigs.ts +++ b/packages/autumn-js/src/backend/core/routes/routeConfigs.ts @@ -5,7 +5,7 @@ import { createReferralCodeParamsSchema, eventsAggregateParamsSchema, eventsListParamsSchema, - listPlansRequestSchema, + listPlansParamsSchema, openCustomerPortalParamsSchema, redeemReferralCodeParamsSchema, } from "../../../generated"; @@ -76,7 +76,7 @@ export const routeConfigs: RouteDefinition[] = [ route: "listPlans", sdkMethod: (autumn, args) => autumn.plans.list(args), requireCustomer: false, - bodySchema: listPlansRequestSchema.optional(), + bodySchema: listPlansParamsSchema.optional(), }, { route: "listEvents", diff --git a/packages/autumn-js/src/generated/listPlansSchemas.ts b/packages/autumn-js/src/generated/listPlansSchemas.ts index f173dc90e..f38aeaf52 100644 --- a/packages/autumn-js/src/generated/listPlansSchemas.ts +++ b/packages/autumn-js/src/generated/listPlansSchemas.ts @@ -5,20 +5,140 @@ export const listPlansGlobalsSchema = z.object({ xApiVersion: z.union([z.string(), z.undefined()]).optional(), }); -export const listPlansRequestSchema = z.object({ +export const listPlansParamsSchema = z.object({ customerId: z.union([z.string(), z.undefined()]).optional(), entityId: z.union([z.string(), z.undefined()]).optional(), includeArchived: z.union([z.boolean(), z.undefined()]).optional(), }); -export const listPlansRequestOutboundSchema = z.object({ +export const listPlansPriceDisplaySchema = z.object({ + primaryText: z.string(), + secondaryText: z.union([z.string(), z.undefined()]).optional(), +}); + +export const listPlansFeatureDisplaySchema = z.object({ + singular: z.string(), + plural: z.string(), +}); + +export const listPlansCreditSchemaSchema = z.object({ + meteredFeatureId: z.string(), + creditCost: z.number(), +}); + +export const listPlansToSchema = z.union([z.number(), z.string()]); + +export const listPlansTierSchema = z.object({ + to: z.union([z.number(), z.string()]), + amount: z.number(), +}); + +export const listPlansItemDisplaySchema = z.object({ + primaryText: z.string(), + secondaryText: z.union([z.string(), z.undefined()]).optional(), +}); + +export const listPlansParamsOutboundSchema = z.object({ customer_id: z.union([z.string(), z.undefined()]).optional(), entity_id: z.union([z.string(), z.undefined()]).optional(), include_archived: z.union([z.boolean(), z.undefined()]).optional(), }); -const planSchema = z.any(); +const openEnumSchema = z.any(); + +export const listPlansPriceIntervalSchema = openEnumSchema; + +export const listPlansPriceSchema = z.object({ + amount: z.number(), + interval: listPlansPriceIntervalSchema, + intervalCount: z.union([z.number(), z.undefined()]).optional(), + display: z.union([listPlansPriceDisplaySchema, z.undefined()]).optional(), +}); + +export const listPlansTypeSchema = openEnumSchema; + +export const listPlansFeatureSchema = z.object({ + id: z.string(), + name: z.union([z.string(), z.undefined()]).optional().nullable(), + type: listPlansTypeSchema, + display: z + .union([listPlansFeatureDisplaySchema, z.undefined()]) + .optional() + .nullable(), + creditSchema: z + .union([z.array(listPlansCreditSchemaSchema), z.undefined()]) + .optional() + .nullable(), + archived: z.union([z.boolean(), z.undefined()]).optional().nullable(), +}); + +export const listPlansResetIntervalSchema = openEnumSchema; + +export const listPlansResetSchema = z.object({ + interval: listPlansResetIntervalSchema, + intervalCount: z.union([z.number(), z.undefined()]).optional(), +}); + +export const listPlansPriceItemIntervalSchema = openEnumSchema; + +export const listPlansBillingMethodSchema = openEnumSchema; + +export const listPlansItemPriceSchema = z.object({ + amount: z.union([z.number(), z.undefined()]).optional(), + tiers: z.union([z.array(listPlansTierSchema), z.undefined()]).optional(), + interval: listPlansPriceItemIntervalSchema, + intervalCount: z.union([z.number(), z.undefined()]).optional(), + billingUnits: z.number(), + billingMethod: listPlansBillingMethodSchema, + maxPurchase: z.number().nullable(), +}); + +export const listPlansExpiryDurationTypeSchema = openEnumSchema; + +export const listPlansRolloverSchema = z.object({ + max: z.number().nullable(), + expiryDurationType: listPlansExpiryDurationTypeSchema, + expiryDurationLength: z.union([z.number(), z.undefined()]).optional(), +}); + +export const listPlansItemSchema = z.object({ + featureId: z.string(), + feature: z.union([listPlansFeatureSchema, z.undefined()]).optional(), + included: z.number(), + unlimited: z.boolean(), + reset: listPlansResetSchema.nullable(), + price: listPlansItemPriceSchema.nullable(), + display: z.union([listPlansItemDisplaySchema, z.undefined()]).optional(), + rollover: z.union([listPlansRolloverSchema, z.undefined()]).optional(), +}); + +export const listPlansDurationTypeSchema = openEnumSchema; + +export const listPlansFreeTrialSchema = z.object({ + durationLength: z.number(), + durationType: listPlansDurationTypeSchema, + cardRequired: z.boolean(), +}); + +export const listPlansEnvSchema = openEnumSchema; + +export const listPlansListSchema = z.object({ + id: z.string(), + name: z.string(), + description: z.string().nullable(), + group: z.string().nullable(), + version: z.number(), + addOn: z.boolean(), + autoEnable: z.boolean(), + price: listPlansPriceSchema.nullable(), + items: z.array(listPlansItemSchema), + freeTrial: z.union([listPlansFreeTrialSchema, z.undefined()]).optional(), + createdAt: z.number(), + env: listPlansEnvSchema, + archived: z.boolean(), + baseVariantId: z.string().nullable(), +}); export const listPlansResponseSchema = z.object({ - list: z.array(planSchema), + list: z.array(listPlansListSchema), }); diff --git a/packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts b/packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts index 63f7ec0a1..aedb1c1ec 100644 --- a/packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts +++ b/packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts @@ -29,6 +29,11 @@ const redirectToUrl = ({ } }; +type SetupPaymentParams = { + successUrl?: string; + openInNewTab?: boolean; +}; + export const useCustomerActions = ({ client, customer, @@ -87,11 +92,43 @@ export const useCustomerActions = ({ [client], ); + const setupPayment = useCallback( + async (params: SetupPaymentParams = {}) => { + const setupPaymentClient = client as IAutumnClient & { + setupPayment: (args: { successUrl?: string }) => Promise<{ + paymentUrl?: string | null; + url?: string; + }>; + }; + + const response = await setupPaymentClient.setupPayment({ + successUrl: params.successUrl ?? window.location.href, + }); + + const redirectUrl = response.url ?? response.paymentUrl; + if (redirectUrl) { + redirectToUrl({ + url: redirectUrl, + openInNewTab: params.openInNewTab, + }); + } + + return response; + }, + [client], + ); + return { attach, check, openCustomerPortal, + setupPayment, }; }; -export type { AttachParams, CheckParams, OpenCustomerPortalParams }; +export type { + AttachParams, + CheckParams, + OpenCustomerPortalParams, + SetupPaymentParams, +}; diff --git a/packages/openapi/openapi-stripped.yml b/packages/openapi/openapi-stripped.yml index 12ec0bfd8..a4ae15485 100644 --- a/packages/openapi/openapi-stripped.yml +++ b/packages/openapi/openapi-stripped.yml @@ -486,28 +486,40 @@ components: properties: id: type: string + description: Unique identifier for the plan. name: type: string + description: Display name of the plan. description: anyOf: - type: string - type: "null" + description: Optional description of the plan. group: anyOf: - type: string - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. version: type: number + description: Version number of the plan. Incremented when plan configuration + changes. add_on: type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. auto_enable: type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. price: anyOf: - type: object properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -516,21 +528,28 @@ components: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. display: type: object properties: primary_text: type: string + description: Main display text (e.g. '$10' or '100 messages'). secondary_text: type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). required: - primary_text + description: Display text for showing this price in pricing pages. required: - amount - interval - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. items: type: array items: @@ -538,6 +557,7 @@ components: properties: feature_id: type: string + description: The ID of the feature this item configures. feature: type: object properties: @@ -598,10 +618,14 @@ components: required: - id - type + description: The full feature object if expanded. included: type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. unlimited: type: boolean + description: Whether the customer has unlimited access to this feature. reset: anyOf: - type: object @@ -617,17 +641,26 @@ components: - quarter - semi_annual - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, usage resets to 0 + and included units are restored. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage persists across + billing cycles. price: anyOf: - type: object properties: amount: type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. tiers: type: array items: @@ -642,6 +675,9 @@ components: required: - to - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or 'amount' is + required. interval: enum: - one_off @@ -650,33 +686,50 @@ components: - quarter - semi_annual - year + description: Billing interval for this price. For consumable features, should + match reset.interval. interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed (e.g. + billing_units=100 means 101 usage rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after included usage." max_purchase: anyOf: - type: number - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, customer can use up + to 400 total before usage is capped. Null for no + limit. required: - interval - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. display: type: object properties: primary_text: type: string + description: Main display text (e.g. '$10' or '100 messages'). secondary_text: type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). required: - primary_text + description: Display text for showing this item in pricing pages. rollover: type: object properties: @@ -684,83 +737,67 @@ components: anyOf: - type: number - type: "null" + description: Maximum rollover units. Null for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - max - expiry_duration_type - proration: - type: object - properties: - on_increase: - enum: - - bill_immediately - - prorate_immediately - - prorate_next_cycle - - bill_next_cycle - on_decrease: - enum: - - prorate - - prorate_immediately - - prorate_next_cycle - - none - - no_prorations + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. required: - feature_id - included - unlimited - reset - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a feature. free_trial: type: object properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year + description: Unit of time for the trial duration ('day', 'month', 'year'). card_required: type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. required: - duration_length - duration_type - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. created_at: type: number + description: Unix timestamp (ms) when the plan was created. env: enum: - sandbox - live + description: Environment this plan belongs to ('sandbox' or 'live'). archived: type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. base_variant_id: anyOf: - type: string - type: "null" - customer_eligibility: - type: object - properties: - trial_available: - type: boolean - scenario: - enum: - - scheduled - - active - - new - - renew - - upgrade - - downgrade - - cancel - - expired - - past_due - required: - - scenario + description: If this is a variant, the ID of the base plan it was created from. required: - id - name @@ -1830,10 +1867,1108 @@ paths: x-speakeasy-name-override: delete parameters: - *a5 + /v1/plans.create: + post: + operationId: createPlan + summary: Create a plan + description: >- + Creates a new plan with optional base price and feature configurations. + + + Use this to programmatically create pricing plans. See [How plans + work](/documentation/pricing/plans) for concepts. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: The ID of the plan to create. + group: + type: string + default: "" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + name: + type: string + minLength: 1 + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + default: null + description: Optional description of the plan. + add_on: + type: boolean + default: false + description: If true, this plan can be attached alongside other plans. + Otherwise, attaching replaces existing plans in the same + group. + auto_enable: + type: boolean + default: false + description: If true, plan is automatically attached when a customer is created. + Use for free tiers. + price: + type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + required: + - amount + - interval + description: Base recurring price for the plan. Omit for free or usage-only + plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature to configure. + included: + type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. + unlimited: + type: boolean + description: If true, customer has unlimited access to this feature. + reset: + type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. + price: + type: object + properties: + amount: + type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval. For consumable features, should match + reset.interval. + interval_count: + type: number + default: 1 + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." + max_purchase: + type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. + required: + - interval + - billing_method + description: Pricing for usage beyond included units. Omit for free features. + proration: + type: object + properties: + on_increase: + enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. + on_decrease: + enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + description: Credit behavior when quantity decreases mid-cycle. + required: + - on_increase + - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. + rollover: + type: object + properties: + max: + type: number + description: Max rollover units. Omit for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. + required: + - feature_id + description: Feature configurations for this plan. Each item defines included + units, pricing, and reset behavior. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + default: month + description: Unit of time for the trial ('day', 'month', 'year'). + card_required: + type: boolean + default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. + required: + - duration_length + description: Free trial configuration. Customers can try this plan before being + charged. + required: + - plan_id + - name + title: CreatePlanParams + examples: + - &a9 + plan_id: free_plan + name: Free + auto_enable: true + items: + - feature_id: messages + included: 100 + reset: + interval: month + - plan_id: pro_plan + name: Pro Plan + price: + amount: 10 + interval: month + items: + - feature_id: messages + included: 1000 + reset: + interval: month + price: + amount: 0.01 + interval: month + billing_units: 1 + billing_method: usage_based + - plan_id: team_plan + name: Team Plan + price: + amount: 49 + interval: month + items: + - feature_id: seats + included: 5 + price: + amount: 10 + interval: month + billing_units: 1 + billing_method: prepaid + example: *a9 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration + changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, usage + resets to 0 and included units are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage + persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or + 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should + match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed (e.g. + billing_units=100 means 101 usage rounds to + 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after + included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, customer + can use up to 400 total before usage is + capped. Null for no limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that + can be attached to customers. + examples: + - &a10 + id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + example: *a10 + x-speakeasy-name-override: create + parameters: + - *a5 + /v1/plans.get: + post: + operationId: getPlan + summary: Get a plan + description: >- + Retrieves a single plan by its ID. + + + Use this to fetch the full configuration of a specific plan, including + its features and pricing. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + description: The ID of the plan to retrieve. + version: + type: number + description: The version of the plan to get. Defaults to the latest version. + required: + - plan_id + title: GetPlanParams + examples: + - &a11 + plan_id: pro_plan + - plan_id: pro_plan + version: 2 + example: *a11 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration + changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, usage + resets to 0 and included units are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage + persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or + 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should + match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed (e.g. + billing_units=100 means 101 usage rounds to + 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after + included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, customer + can use up to 400 total before usage is + capped. Null for no limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that + can be attached to customers. + examples: + - &a12 + id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + example: *a12 + x-speakeasy-name-override: get + parameters: + - *a5 /v1/plans.list: post: operationId: listPlans summary: List all plans + description: >- + Lists all plans in the current environment. + + + Use this to retrieve all plans for displaying pricing pages or managing + plan configurations. tags: - plans requestBody: @@ -1845,10 +2980,20 @@ paths: properties: customer_id: type: string + description: Customer ID to include eligibility info (trial availability, attach + scenario). entity_id: type: string + description: Entity ID for entity-scoped plans. include_archived: type: boolean + description: If true, includes archived plans in the response. + title: ListPlansParams + examples: + - &a13 {} + - customer_id: cus_123 + - include_archived: true + example: *a13 responses: "200": description: OK @@ -1860,12 +3005,1093 @@ paths: list: type: array items: - $ref: "#/components/schemas/Plan" + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration + changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, + usage resets to 0 and included units + are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage + persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or + 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should + match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed + (e.g. billing_units=100 means 101 + usage rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after + included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, + customer can use up to 400 total + before usage is capped. Null for no + limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a + feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that + can be attached to customers. required: - list + examples: + - &a14 + list: + - id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + example: *a14 x-speakeasy-name-override: list parameters: - *a5 + /v1/plans.update: + post: + operationId: updatePlan + summary: Update a plan + description: >- + Updates an existing plan. Creates a new version unless `disableVersion` + is set. + + + Use this to modify plan properties, pricing, or feature configurations. + See [Adding features to plans](/documentation/pricing/plan-features) for + item configuration. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: The ID of the plan to update. + group: + type: string + default: "" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + name: + type: string + minLength: 1 + description: Display name of the plan. + description: + type: string + add_on: + type: boolean + description: Whether the plan is an add-on. + auto_enable: + type: boolean + description: Whether the plan is automatically enabled. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + required: + - amount + - interval + - type: "null" + description: The price of the plan. Set to null to remove the base price. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature to configure. + included: + type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. + unlimited: + type: boolean + description: If true, customer has unlimited access to this feature. + reset: + type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. + price: + type: object + properties: + amount: + type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval. For consumable features, should match + reset.interval. + interval_count: + type: number + default: 1 + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." + max_purchase: + type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. + required: + - interval + - billing_method + description: Pricing for usage beyond included units. Omit for free features. + proration: + type: object + properties: + on_increase: + enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. + on_decrease: + enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + description: Credit behavior when quantity decreases mid-cycle. + required: + - on_increase + - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. + rollover: + type: object + properties: + max: + type: number + description: Max rollover units. Omit for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. + required: + - feature_id + description: Feature configurations for this plan. Each item defines included + units, pricing, and reset behavior. + free_trial: + anyOf: + - type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + default: month + description: Unit of time for the trial ('day', 'month', 'year'). + card_required: + type: boolean + default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. + required: + - duration_length + - type: "null" + description: The free trial of the plan. Set to null to remove the free trial. + version: + type: number + archived: + type: boolean + default: false + new_plan_id: + type: string + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: The new ID to use for the plan. Can only be updated if the plan has + not been used by any customers. + required: + - plan_id + title: UpdatePlanParams + examples: + - &a15 + plan_id: pro_plan + name: Pro Plan (Updated) + price: + amount: 15 + interval: month + - plan_id: pro_plan + price: null + - plan_id: old_plan + archived: true + example: *a15 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration + changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, usage + resets to 0 and included units are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage + persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or + 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should + match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed (e.g. + billing_units=100 means 101 usage rounds to + 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after + included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, customer + can use up to 400 total before usage is + capped. Null for no limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that + can be attached to customers. + examples: + - &a16 + id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + example: *a16 + x-speakeasy-name-override: update + parameters: + - *a5 + /v1/plans.delete: + post: + operationId: deletePlan + summary: Delete a plan + description: >- + Deletes a plan by its ID. + + + Use this to permanently remove a plan. Plans with active customers + cannot be deleted - archive them instead. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + description: The ID of the plan to delete. + all_versions: + type: boolean + default: false + description: If true, deletes all versions of the plan. Otherwise, only deletes + the latest version. + required: + - plan_id + title: DeletePlanParams + examples: + - &a17 + plan_id: unused_plan + - plan_id: legacy_plan + all_versions: true + example: *a17 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + required: + - success + x-speakeasy-name-override: delete + parameters: + - *a5 /v1/features.create: post: operationId: createFeature @@ -1942,7 +4168,7 @@ paths: - feature_id title: CreateFeatureParams examples: - - &a9 + - &a18 feature_id: api-calls name: API Calls type: metered @@ -1956,7 +4182,7 @@ paths: credit_cost: 1 - metered_feature_id: image-generations credit_cost: 10 - example: *a9 + example: *a18 responses: "200": description: OK @@ -2032,7 +4258,7 @@ paths: - consumable - archived examples: - - &a10 + - &a19 id: api-calls name: API Calls type: metered @@ -2041,7 +4267,7 @@ paths: display: singular: API call plural: API calls - example: *a10 + example: *a19 x-speakeasy-name-override: create parameters: - *a5 @@ -2068,9 +4294,9 @@ paths: - feature_id title: GetFeatureParams examples: - - &a11 + - &a20 feature_id: api-calls - example: *a11 + example: *a20 responses: "200": description: OK @@ -2146,7 +4372,7 @@ paths: - consumable - archived examples: - - &a12 + - &a21 id: api-calls name: API Calls type: metered @@ -2155,7 +4381,7 @@ paths: display: singular: API call plural: API calls - example: *a12 + example: *a21 x-speakeasy-name-override: get parameters: - *a5 @@ -2252,7 +4478,7 @@ paths: required: - list examples: - - &a13 + - &a22 list: - id: api-calls name: API Calls @@ -2275,7 +4501,7 @@ paths: display: singular: credit plural: credits - example: *a13 + example: *a22 x-speakeasy-name-override: list parameters: - *a5 @@ -2362,7 +4588,7 @@ paths: - feature_id title: UpdateFeatureParams examples: - - &a14 + - &a23 feature_id: api-calls name: API Requests display: @@ -2370,7 +4596,7 @@ paths: plural: API requests - feature_id: old-feature archived: true - example: *a14 + example: *a23 responses: "200": description: OK @@ -2446,7 +4672,7 @@ paths: - consumable - archived examples: - - &a15 + - &a24 id: api-calls name: API Calls type: metered @@ -2455,7 +4681,7 @@ paths: display: singular: API call plural: API calls - example: *a15 + example: *a24 x-speakeasy-name-override: update parameters: - *a5 @@ -2484,9 +4710,9 @@ paths: - feature_id title: DeleteFeatureParams examples: - - &a16 + - &a25 feature_id: old-feature - example: *a16 + example: *a25 responses: "200": description: OK @@ -2500,9 +4726,9 @@ paths: required: - success examples: - - &a17 + - &a26 success: true - example: *a17 + example: *a26 x-speakeasy-name-override: delete parameters: - *a5 @@ -2561,15 +4787,19 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. required: - duration_length - type: "null" @@ -2584,6 +4814,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -2592,8 +4823,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -2605,10 +4838,14 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -2623,15 +4860,22 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. tiers: type: array items: @@ -2646,6 +4890,8 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -2654,21 +4900,31 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match + reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -2678,6 +4934,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -2685,22 +4942,30 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the @@ -2778,10 +5043,10 @@ paths: - plan_id title: AttachParams examples: - - &a18 + - &a27 customer_id: cus_123 plan_id: pro_plan - example: *a18 + example: *a27 responses: "200": description: OK @@ -2854,10 +5119,10 @@ paths: - customer_id - payment_url examples: - - &a19 + - &a28 customer_id: cus_123 payment_url: https://checkout.stripe.com/... - example: *a19 + example: *a28 x-speakeasy-name-override: attach parameters: - *a5 @@ -2916,15 +5181,19 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. required: - duration_length - type: "null" @@ -2939,6 +5208,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -2947,8 +5217,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -2960,10 +5232,14 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -2978,15 +5254,22 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. tiers: type: array items: @@ -3001,6 +5284,8 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -3009,21 +5294,31 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match + reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -3033,6 +5328,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -3040,22 +5336,30 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the @@ -3133,10 +5437,10 @@ paths: - plan_id title: PreviewAttachParams examples: - - &a20 + - &a29 customer_id: cus_123 plan_id: pro_plan - example: *a20 + example: *a29 responses: "200": description: OK @@ -3210,7 +5514,7 @@ paths: - total - currency examples: - - &a21 + - &a30 customerId: charles lineItems: - title: Pro seed @@ -3219,7 +5523,7 @@ paths: discounts: [] total: 20 currency: usd - example: *a21 + example: *a30 x-speakeasy-name-override: previewAttach parameters: - *a5 @@ -3278,15 +5582,19 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. required: - duration_length - type: "null" @@ -3301,6 +5609,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -3309,8 +5618,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -3322,10 +5633,14 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -3340,15 +5655,22 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. tiers: type: array items: @@ -3363,6 +5685,8 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -3371,21 +5695,31 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match + reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -3395,6 +5729,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -3402,22 +5737,30 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the @@ -3466,13 +5809,13 @@ paths: - plan_id title: UpdateSubscriptionParams examples: - - &a22 + - &a31 customer_id: cus_123 plan_id: pro_plan feature_quantities: - feature_id: seats quantity: 10 - example: *a22 + example: *a31 responses: "200": description: OK @@ -3545,7 +5888,7 @@ paths: - customer_id - payment_url examples: - - &a23 + - &a32 customer_id: cus_123 invoice: status: paid @@ -3554,7 +5897,7 @@ paths: currency: usd hosted_invoice_url: https://invoice.stripe.com/... payment_url: null - example: *a23 + example: *a32 x-speakeasy-name-override: update parameters: - *a5 @@ -3613,15 +5956,19 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. required: - duration_length - type: "null" @@ -3636,6 +5983,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -3644,8 +5992,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -3657,10 +6007,14 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -3675,15 +6029,22 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. tiers: type: array items: @@ -3698,6 +6059,8 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -3706,21 +6069,31 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match + reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -3730,6 +6103,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -3737,22 +6111,30 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the @@ -3801,13 +6183,13 @@ paths: - plan_id title: PreviewUpdateParams examples: - - &a24 + - &a33 customer_id: cus_123 plan_id: pro_plan feature_quantities: - feature_id: seats quantity: 15 - example: *a24 + example: *a33 responses: "200": description: OK @@ -3881,7 +6263,7 @@ paths: - total - currency examples: - - &a25 + - &a34 customerId: charles lineItems: - title: Pro seed @@ -3890,7 +6272,7 @@ paths: discounts: [] total: 20 currency: usd - example: *a25 + example: *a34 x-speakeasy-name-override: previewUpdate parameters: - *a5 @@ -3923,10 +6305,10 @@ paths: - customer_id title: OpenCustomerPortalParams examples: - - &a26 + - &a35 customer_id: cus_123 return_url: https://useautumn.com - example: *a26 + example: *a35 responses: "200": description: OK @@ -3945,13 +6327,75 @@ paths: - customer_id - url examples: - - &a27 + - &a36 customer_id: cus_123 url: https://billing.stripe.com/session/... - example: *a27 + example: *a36 x-speakeasy-name-override: openCustomerPortal parameters: - *a5 + /v1/billing.setup_payment: + post: + operationId: setupPayment + description: Create a payment setup session for a customer to add or update + their payment method. + tags: + - billing + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer + success_url: + type: string + description: URL to redirect to after successful payment setup. Must start with + either http:// or https:// + customer_data: + $ref: "#/components/schemas/CustomerData" + checkout_session_params: + type: object + propertyNames: + type: string + additionalProperties: {} + description: Additional parameters for the checkout session + required: + - customer_id + title: SetupPaymentParams + examples: + - &a37 + customer_id: cus_123 + success_url: https://example.com/account/billing + example: *a37 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer + url: + type: string + description: URL to the payment setup page + required: + - customer_id + - url + examples: + - &a38 + customer_id: cus_123 + payment_url: https://checkout.stripe.com/... + example: *a38 + x-speakeasy-name-override: setupPayment + parameters: + - *a5 /v1/balances.create: post: operationId: createBalance @@ -4017,13 +6461,13 @@ paths: - feature_id title: CreateBalanceParams examples: - - &a28 + - &a39 customer_id: cus_123 feature_id: api_calls included: 1000 reset: interval: month - example: *a28 + example: *a39 responses: "200": description: OK @@ -4089,11 +6533,11 @@ paths: - feature_id title: UpdateBalanceParams examples: - - &a29 + - &a40 customer_id: cus_123 feature_id: api_calls remaining: 5 - example: *a29 + example: *a40 responses: "200": description: OK @@ -4160,14 +6604,14 @@ paths: - feature_id title: CheckParams examples: - - &a30 + - &a41 customer_id: cus_123 feature_id: messages - customer_id: cus_123 feature_id: messages required_balance: 3 send_event: true - example: *a30 + example: *a41 responses: "200": description: OK @@ -4548,7 +6992,7 @@ paths: - customer_id - balance examples: - - &a31 + - &a42 allowed: true customer_id: cus_123 entity_id: null @@ -4575,7 +7019,7 @@ paths: resets_at: 1773851121437 price: null expires_at: null - example: *a31 + example: *a42 x-speakeasy-name-override: check parameters: - *a5 @@ -4625,11 +7069,11 @@ paths: - customer_id title: TrackParams examples: - - &a32 + - &a43 customer_id: cus_123 feature_id: messages value: 1 - example: *a32 + example: *a43 responses: "200": description: OK @@ -4670,7 +7114,7 @@ paths: - value - balance examples: - - &a33 + - &a44 customer_id: cus_123 value: 1 balance: @@ -4695,7 +7139,7 @@ paths: resets_at: 1773851121437 price: null expires_at: null - example: *a33 + example: *a44 x-speakeasy-name-override: track parameters: - *a5 @@ -4749,14 +7193,14 @@ paths: description: Filter events by time range title: EventsListParams examples: - - &a34 + - &a45 customer_id: cus_123 limit: 50 - feature_id: api_calls custom_range: start: 1704067200000 end: 1706745600000 - example: *a34 + example: *a45 responses: "200": description: OK @@ -4815,7 +7259,7 @@ paths: - limit - total examples: - - &a35 + - &a46 list: - id: evt_36xpk2TmuQX5zVPPQ8tCtnR5Weg timestamp: 1765958215459 @@ -4833,7 +7277,7 @@ paths: has_more: false offset: 0 limit: 100 - example: *a35 + example: *a46 x-speakeasy-name-override: list parameters: - *a5 @@ -4905,7 +7349,7 @@ paths: - feature_id title: EventsAggregateParams examples: - - &a36 + - &a47 customer_id: cus_123 feature_id: api_calls range: 30d @@ -4916,7 +7360,7 @@ paths: - messages range: 7d group_by: properties.model - example: *a36 + example: *a47 responses: "200": description: OK @@ -4978,7 +7422,7 @@ paths: - list - total examples: - - &a37 + - &a48 list: - period: 1762905600000 values: @@ -5025,7 +7469,7 @@ paths: sessions: count: 2 sum: 15 - example: *a37 + example: *a48 x-speakeasy-name-override: aggregate parameters: - *a5 @@ -5072,12 +7516,12 @@ paths: - entity_id title: CreateEntityParams examples: - - &a38 + - &a49 customer_id: cus_123 entity_id: seat_42 feature_id: seats name: Seat 42 - example: *a38 + example: *a49 responses: "200": description: OK @@ -5267,7 +7711,7 @@ paths: - purchases - balances examples: - - &a39 + - &a50 id: seat_42 name: Seat 42 customer_id: cus_123 @@ -5312,7 +7756,7 @@ paths: price: null expires_at: null invoices: [] - example: *a39 + example: *a50 x-speakeasy-name-override: create parameters: - *a5 @@ -5344,11 +7788,11 @@ paths: - entity_id title: GetEntityParams examples: - - &a40 + - &a51 entity_id: seat_42 - customer_id: cus_123 entity_id: seat_42 - example: *a40 + example: *a51 responses: "200": description: OK @@ -5538,7 +7982,7 @@ paths: - purchases - balances examples: - - &a41 + - &a52 id: seat_42 name: Seat 42 customer_id: cus_123 @@ -5583,7 +8027,7 @@ paths: price: null expires_at: null invoices: [] - example: *a41 + example: *a52 x-speakeasy-name-override: get parameters: - *a5 @@ -5615,10 +8059,10 @@ paths: - entity_id title: DeleteEntityParams examples: - - &a42 + - &a53 customer_id: cus_123 entity_id: seat_42 - example: *a42 + example: *a53 responses: "200": description: OK @@ -5632,9 +8076,9 @@ paths: required: - success examples: - - &a43 + - &a54 success: true - example: *a43 + example: *a54 x-speakeasy-name-override: delete parameters: - *a5 @@ -5662,10 +8106,10 @@ paths: - program_id title: CreateReferralCodeParams examples: - - &a44 + - &a55 customer_id: cus_123 program_id: prog_123 - example: *a44 + example: *a55 responses: "200": description: OK @@ -5688,11 +8132,11 @@ paths: - customer_id - created_at examples: - - &a45 + - &a56 code: customer_id: created_at: 123 - example: *a45 + example: *a56 x-speakeasy-name-override: createCode parameters: - *a5 @@ -5720,10 +8164,10 @@ paths: - customer_id title: RedeemReferralCodeParams examples: - - &a46 + - &a57 code: REF123 customer_id: cus_456 - example: *a46 + example: *a57 responses: "200": description: OK @@ -5746,11 +8190,11 @@ paths: - customer_id - reward_id examples: - - &a47 + - &a58 id: customer_id: reward_id: - example: *a47 + example: *a58 x-speakeasy-name-override: redeemCode parameters: - *a5 diff --git a/packages/openapi/openapi.yml b/packages/openapi/openapi.yml index 44da51a20..7d0e0d32c 100644 --- a/packages/openapi/openapi.yml +++ b/packages/openapi/openapi.yml @@ -485,28 +485,40 @@ components: properties: id: type: string + description: Unique identifier for the plan. name: type: string + description: Display name of the plan. description: anyOf: - type: string - type: "null" + description: Optional description of the plan. group: anyOf: - type: string - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. version: type: number + description: Version number of the plan. Incremented when plan configuration + changes. add_on: type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. auto_enable: type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. price: anyOf: - type: object properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -515,21 +527,28 @@ components: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. display: type: object properties: primary_text: type: string + description: Main display text (e.g. '$10' or '100 messages'). secondary_text: type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). required: - primary_text + description: Display text for showing this price in pricing pages. required: - amount - interval - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. items: type: array items: @@ -537,6 +556,7 @@ components: properties: feature_id: type: string + description: The ID of the feature this item configures. feature: type: object properties: @@ -597,10 +617,14 @@ components: required: - id - type + description: The full feature object if expanded. included: type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. unlimited: type: boolean + description: Whether the customer has unlimited access to this feature. reset: anyOf: - type: object @@ -616,17 +640,26 @@ components: - quarter - semi_annual - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, usage resets to 0 + and included units are restored. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage persists across + billing cycles. price: anyOf: - type: object properties: amount: type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. tiers: type: array items: @@ -641,6 +674,9 @@ components: required: - to - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or 'amount' is + required. interval: enum: - one_off @@ -649,33 +685,50 @@ components: - quarter - semi_annual - year + description: Billing interval for this price. For consumable features, should + match reset.interval. interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed (e.g. + billing_units=100 means 101 usage rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after included usage." max_purchase: anyOf: - type: number - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, customer can use up + to 400 total before usage is capped. Null for no + limit. required: - interval - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. display: type: object properties: primary_text: type: string + description: Main display text (e.g. '$10' or '100 messages'). secondary_text: type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). required: - primary_text + description: Display text for showing this item in pricing pages. rollover: type: object properties: @@ -683,83 +736,67 @@ components: anyOf: - type: number - type: "null" + description: Maximum rollover units. Null for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - max - expiry_duration_type - proration: - type: object - properties: - on_increase: - enum: - - bill_immediately - - prorate_immediately - - prorate_next_cycle - - bill_next_cycle - on_decrease: - enum: - - prorate - - prorate_immediately - - prorate_next_cycle - - none - - no_prorations + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. required: - feature_id - included - unlimited - reset - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a feature. free_trial: type: object properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year + description: Unit of time for the trial duration ('day', 'month', 'year'). card_required: type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. required: - duration_length - duration_type - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. created_at: type: number + description: Unix timestamp (ms) when the plan was created. env: enum: - sandbox - live + description: Environment this plan belongs to ('sandbox' or 'live'). archived: type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. base_variant_id: anyOf: - type: string - type: "null" - customer_eligibility: - type: object - properties: - trial_available: - type: boolean - scenario: - enum: - - scheduled - - active - - new - - renew - - upgrade - - downgrade - - cancel - - expired - - past_due - required: - - scenario + description: If this is a variant, the ID of the base plan it was created from. required: - id - name @@ -1851,10 +1888,1207 @@ paths: x-speakeasy-name-override: delete parameters: - *a1 + /v1/plans.create: + post: + operationId: createPlan + summary: Create a plan + description: |- + Creates a new plan with optional base price and feature configurations. + + Use this to programmatically create pricing plans. See [How plans work](/documentation/pricing/plans) for concepts. + + @example + ```typescript + // Create a free plan with limited features + const response = await client.plans.create({ + planId: "free_plan", + name: "Free", + autoEnable: true, + items: [{"featureId":"messages","included":100,"reset":{"interval":"month"}}], + }); + ``` + + @example + ```typescript + // Create a paid plan with base price and usage-based feature + const response = await client.plans.create({ + planId: "pro_plan", + name: "Pro Plan", + price: {"amount":10,"interval":"month"}, + items: [{"featureId":"messages","included":1000,"reset":{"interval":"month"},"price":{"amount":0.01,"interval":"month","billingUnits":1,"billingMethod":"usage_based"}}], + }); + ``` + + @example + ```typescript + // Create a plan with prepaid seats + const response = await client.plans.create({ + planId: "team_plan", + name: "Team Plan", + price: {"amount":49,"interval":"month"}, + items: [{"featureId":"seats","included":5,"price":{"amount":10,"interval":"month","billingUnits":1,"billingMethod":"prepaid"}}], + }); + ``` + + @example + ```typescript + // Create an add-on plan + const response = await client.plans.create({ + planId: "analytics_addon", + name: "Advanced Analytics", + addOn: true, + price: {"amount":20,"interval":"month"}, + }); + ``` + + @example + ```typescript + // Create a plan with tiered pricing + const response = await client.plans.create({ planId: "api_plan", name: "API Plan", items: [{"featureId":"api_calls","included":1000,"reset":{"interval":"month"},"price":{"tiers":[{"to":10000,"amount":0.001},{"to":100000,"amount":0.0005},{"to":"inf","amount":0.0001}],"interval":"month","billingUnits":1,"billingMethod":"usage_based"}}] }); + ``` + + @example + ```typescript + // Create a plan with free trial + const response = await client.plans.create({ + planId: "premium_plan", + name: "Premium", + price: {"amount":99,"interval":"month"}, + freeTrial: {"durationLength":14,"durationType":"day","cardRequired":true}, + }); + ``` + + @param planId - The ID of the plan to create. + @param group - Group identifier for organizing related plans. Plans in the same group are mutually exclusive. (optional) + @param name - Display name of the plan. + @param description - Optional description of the plan. (optional) + @param addOn - If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. (optional) + @param autoEnable - If true, plan is automatically attached when a customer is created. Use for free tiers. (optional) + @param price - Base recurring price for the plan. Omit for free or usage-only plans. (optional) + @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional) + @param freeTrial - Free trial configuration. Customers can try this plan before being charged. (optional) + + @returns The created plan object. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: The ID of the plan to create. + group: + type: string + default: "" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + name: + type: string + minLength: 1 + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + default: null + description: Optional description of the plan. + add_on: + type: boolean + default: false + description: If true, this plan can be attached alongside other plans. + Otherwise, attaching replaces existing plans in the same + group. + auto_enable: + type: boolean + default: false + description: If true, plan is automatically attached when a customer is created. + Use for free tiers. + price: + type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + required: + - amount + - interval + description: Base recurring price for the plan. Omit for free or usage-only + plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature to configure. + included: + type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. + unlimited: + type: boolean + description: If true, customer has unlimited access to this feature. + reset: + type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. + price: + type: object + properties: + amount: + type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval. For consumable features, should match + reset.interval. + interval_count: + type: number + default: 1 + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." + max_purchase: + type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. + required: + - interval + - billing_method + description: Pricing for usage beyond included units. Omit for free features. + proration: + type: object + properties: + on_increase: + enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. + on_decrease: + enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + description: Credit behavior when quantity decreases mid-cycle. + required: + - on_increase + - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. + rollover: + type: object + properties: + max: + type: number + description: Max rollover units. Omit for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. + required: + - feature_id + description: Feature configurations for this plan. Each item defines included + units, pricing, and reset behavior. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + default: month + description: Unit of time for the trial ('day', 'month', 'year'). + card_required: + type: boolean + default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. + required: + - duration_length + description: Free trial configuration. Customers can try this plan before being + charged. + required: + - plan_id + - name + title: CreatePlanParams + examples: + - plan_id: free_plan + name: Free + auto_enable: true + items: + - feature_id: messages + included: 100 + reset: + interval: month + - plan_id: pro_plan + name: Pro Plan + price: + amount: 10 + interval: month + items: + - feature_id: messages + included: 1000 + reset: + interval: month + price: + amount: 0.01 + interval: month + billing_units: 1 + billing_method: usage_based + - plan_id: team_plan + name: Team Plan + price: + amount: 49 + interval: month + items: + - feature_id: seats + included: 5 + price: + amount: 10 + interval: month + billing_units: 1 + billing_method: prepaid + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration + changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, usage + resets to 0 and included units are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage + persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or + 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should + match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed (e.g. + billing_units=100 means 101 usage rounds to + 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after + included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, customer + can use up to 400 total before usage is + capped. Null for no limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that + can be attached to customers. + examples: + - id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + x-speakeasy-name-override: create + parameters: + - *a1 + /v1/plans.get: + post: + operationId: getPlan + summary: Get a plan + description: >- + Retrieves a single plan by its ID. + + + Use this to fetch the full configuration of a specific plan, including + its features and pricing. + + + @example + + ```typescript + + // Get a plan by ID + + const response = await client.plans.get({ planId: "pro_plan" }); + + ``` + + + @example + + ```typescript + + // Get a specific version of a plan + + const response = await client.plans.get({ planId: "pro_plan", version: 2 + }); + + ``` + + + @param planId - The ID of the plan to retrieve. + + @param version - The version of the plan to get. Defaults to the latest + version. (optional) + + + @returns The plan object with its full configuration. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + description: The ID of the plan to retrieve. + version: + type: number + description: The version of the plan to get. Defaults to the latest version. + required: + - plan_id + title: GetPlanParams + examples: + - plan_id: pro_plan + - plan_id: pro_plan + version: 2 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration + changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, usage + resets to 0 and included units are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage + persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or + 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should + match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed (e.g. + billing_units=100 means 101 usage rounds to + 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after + included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, customer + can use up to 400 total before usage is + capped. Null for no limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that + can be attached to customers. + examples: + - id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + x-speakeasy-name-override: get + parameters: + - *a1 /v1/plans.list: post: operationId: listPlans summary: List all plans + description: >- + Lists all plans in the current environment. + + + Use this to retrieve all plans for displaying pricing pages or managing + plan configurations. + + + @returns A list of all plans with their pricing and feature + configurations. tags: - plans requestBody: @@ -1866,10 +3100,19 @@ paths: properties: customer_id: type: string + description: Customer ID to include eligibility info (trial availability, attach + scenario). entity_id: type: string + description: Entity ID for entity-scoped plans. include_archived: type: boolean + description: If true, includes archived plans in the response. + title: ListPlansParams + examples: + - {} + - customer_id: cus_123 + - include_archived: true responses: "200": description: OK @@ -1881,12 +3124,1155 @@ paths: list: type: array items: - $ref: "#/components/schemas/Plan" + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration + changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, + usage resets to 0 and included units + are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage + persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or + 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should + match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed + (e.g. billing_units=100 means 101 + usage rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after + included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, + customer can use up to 400 total + before usage is capped. Null for no + limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a + feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that + can be attached to customers. required: - list + examples: + - list: + - id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null x-speakeasy-name-override: list parameters: - *a1 + /v1/plans.update: + post: + operationId: updatePlan + summary: Update a plan + description: |- + Updates an existing plan. Creates a new version unless `disableVersion` is set. + + Use this to modify plan properties, pricing, or feature configurations. See [Adding features to plans](/documentation/pricing/plan-features) for item configuration. + + @example + ```typescript + // Update plan name and price + const response = await client.plans.update({ planId: "pro_plan", name: "Pro Plan (Updated)", price: {"amount":15,"interval":"month"} }); + ``` + + @example + ```typescript + // Add a feature to an existing plan + const response = await client.plans.update({ planId: "pro_plan", items: [{"featureId":"messages","included":1000,"reset":{"interval":"month"}},{"featureId":"storage","included":10,"reset":{"interval":"month"}}] }); + ``` + + @example + ```typescript + // Remove the base price (make usage-only) + const response = await client.plans.update({ planId: "pro_plan", price: null }); + ``` + + @example + ```typescript + // Archive a plan + const response = await client.plans.update({ planId: "old_plan", archived: true }); + ``` + + @example + ```typescript + // Update feature's included amount + const response = await client.plans.update({ planId: "pro_plan", items: [{"featureId":"messages","included":2000,"reset":{"interval":"month"}}] }); + ``` + + @param planId - The ID of the plan to update. + @param group - Group identifier for organizing related plans. Plans in the same group are mutually exclusive. (optional) + @param name - Display name of the plan. (optional) + @param addOn - Whether the plan is an add-on. (optional) + @param autoEnable - Whether the plan is automatically enabled. (optional) + @param price - The price of the plan. Set to null to remove the base price. (optional) + @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional) + @param freeTrial - The free trial of the plan. Set to null to remove the free trial. (optional) + @param newPlanId - The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. (optional) + + @returns The updated plan object. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: The ID of the plan to update. + group: + type: string + default: "" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + name: + type: string + minLength: 1 + description: Display name of the plan. + description: + type: string + add_on: + type: boolean + description: Whether the plan is an add-on. + auto_enable: + type: boolean + description: Whether the plan is automatically enabled. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + required: + - amount + - interval + - type: "null" + description: The price of the plan. Set to null to remove the base price. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature to configure. + included: + type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. + unlimited: + type: boolean + description: If true, customer has unlimited access to this feature. + reset: + type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. + price: + type: object + properties: + amount: + type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval. For consumable features, should match + reset.interval. + interval_count: + type: number + default: 1 + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." + max_purchase: + type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. + required: + - interval + - billing_method + description: Pricing for usage beyond included units. Omit for free features. + proration: + type: object + properties: + on_increase: + enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. + on_decrease: + enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + description: Credit behavior when quantity decreases mid-cycle. + required: + - on_increase + - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. + rollover: + type: object + properties: + max: + type: number + description: Max rollover units. Omit for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. + required: + - feature_id + description: Feature configurations for this plan. Each item defines included + units, pricing, and reset behavior. + free_trial: + anyOf: + - type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + default: month + description: Unit of time for the trial ('day', 'month', 'year'). + card_required: + type: boolean + default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. + required: + - duration_length + - type: "null" + description: The free trial of the plan. Set to null to remove the free trial. + version: + type: number + archived: + type: boolean + default: false + new_plan_id: + type: string + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: The new ID to use for the plan. Can only be updated if the plan has + not been used by any customers. + required: + - plan_id + title: UpdatePlanParams + examples: + - plan_id: pro_plan + name: Pro Plan (Updated) + price: + amount: 15 + interval: month + - plan_id: pro_plan + price: null + - plan_id: old_plan + archived: true + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same + group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration + changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a + main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is + created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or + usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance + resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', + 'year'). For consumable features, usage + resets to 0 and included units are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for + non-consumable features like seats where usage + persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually + exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include + the included amount. Either 'tiers' or + 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should + match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the + nearest billing_units when billed (e.g. + billing_units=100 means 101 usage rounds to + 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, + 'usage_based' for pay-as-you-go after + included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if + included=100 and max_purchase=300, customer + can use up to 400 total before usage is + capped. Null for no limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if + feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included + units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines + included units, pricing, and reset behavior for a feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, + customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan + before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to + new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that + can be attached to customers. + examples: + - id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + x-speakeasy-name-override: update + parameters: + - *a1 + /v1/plans.delete: + post: + operationId: deletePlan + summary: Delete a plan + description: >- + Deletes a plan by its ID. + + + Use this to permanently remove a plan. Plans with active customers + cannot be deleted - archive them instead. + + + @example + + ```typescript + + // Delete a plan + + const response = await client.plans.delete({ planId: "unused_plan" }); + + ``` + + + @example + + ```typescript + + // Delete all versions of a plan + + const response = await client.plans.delete({ planId: "legacy_plan", + allVersions: true }); + + ``` + + + @param planId - The ID of the plan to delete. + + @param allVersions - If true, deletes all versions of the plan. + Otherwise, only deletes the latest version. (optional) + + + @returns A success flag indicating the plan was deleted. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + description: The ID of the plan to delete. + all_versions: + type: boolean + default: false + description: If true, deletes all versions of the plan. Otherwise, only deletes + the latest version. + required: + - plan_id + title: DeletePlanParams + examples: + - plan_id: unused_plan + - plan_id: legacy_plan + all_versions: true + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + required: + - success + x-speakeasy-name-override: delete + parameters: + - *a1 /v1/features.create: post: operationId: createFeature @@ -2791,15 +5177,19 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. required: - duration_length - type: "null" @@ -2814,6 +5204,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -2822,8 +5213,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -2835,10 +5228,14 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -2853,15 +5250,22 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. tiers: type: array items: @@ -2876,6 +5280,8 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -2884,21 +5290,31 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match + reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -2908,6 +5324,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -2915,22 +5332,30 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the @@ -3203,15 +5628,19 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. required: - duration_length - type: "null" @@ -3226,6 +5655,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -3234,8 +5664,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -3247,10 +5679,14 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -3265,15 +5701,22 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. tiers: type: array items: @@ -3288,6 +5731,8 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -3296,21 +5741,31 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match + reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -3320,6 +5775,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -3327,22 +5783,30 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the @@ -3635,15 +6099,19 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. required: - duration_length - type: "null" @@ -3658,6 +6126,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -3666,8 +6135,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -3679,10 +6150,14 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -3697,15 +6172,22 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. tiers: type: array items: @@ -3720,6 +6202,8 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -3728,21 +6212,31 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match + reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -3752,6 +6246,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -3759,22 +6254,30 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the @@ -4016,15 +6519,19 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is + charged after trial ends. required: - duration_length - type: "null" @@ -4039,6 +6546,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -4047,8 +6555,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -4060,10 +6570,14 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval + for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -4078,15 +6592,22 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For + consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for + non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or + 'tiers' is required. tiers: type: array items: @@ -4101,6 +6622,8 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. + Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -4109,21 +6632,31 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match + reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. + billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for + pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, + max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -4133,6 +6666,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -4140,22 +6674,30 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle + quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units + carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the @@ -4347,6 +6889,64 @@ paths: x-speakeasy-name-override: openCustomerPortal parameters: - *a1 + /v1/billing.setup_payment: + post: + operationId: setupPayment + description: Create a payment setup session for a customer to add or update + their payment method. + tags: + - billing + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer + success_url: + type: string + description: URL to redirect to after successful payment setup. Must start with + either http:// or https:// + customer_data: + $ref: "#/components/schemas/CustomerData" + checkout_session_params: + type: object + propertyNames: + type: string + additionalProperties: {} + description: Additional parameters for the checkout session + required: + - customer_id + title: SetupPaymentParams + examples: + - customer_id: cus_123 + success_url: https://example.com/account/billing + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer + url: + type: string + description: URL to the payment setup page + required: + - customer_id + - url + examples: + - customer_id: cus_123 + payment_url: https://checkout.stripe.com/... + x-speakeasy-name-override: setupPayment + parameters: + - *a1 /v1/balances.create: post: operationId: createBalance diff --git a/packages/openapi/utils/mintlifyTransform/transformCodeSamples.ts b/packages/openapi/utils/mintlifyTransform/transformCodeSamples.ts index 32d8b8cee..c4a94efeb 100644 --- a/packages/openapi/utils/mintlifyTransform/transformCodeSamples.ts +++ b/packages/openapi/utils/mintlifyTransform/transformCodeSamples.ts @@ -44,57 +44,149 @@ export function transformTypeScriptCodeSample(source: string): string { /** * Formats a Python function call with proper indentation if it has multiple arguments. - * Converts: func(arg1="val1", arg2="val2", arg3="val3") + * Handles nested brackets (lists, dicts) correctly. + * Converts: func(arg1="val1", arg2=[{...}], arg3="val3") * To: func( * arg1="val1", - * arg2="val2", + * arg2=[{...}], * arg3="val3", * ) */ function formatPythonFunctionCall(code: string): string { - // Match function calls like: res = autumn.something.method(args...) - // or just: autumn.something.method(args...) - return code.replace( - /((?:res\s*=\s*)?autumn\.[a-z_.]+)\(([^)]+)\)/gi, - (_match, funcCall: string, argsStr: string) => { - // Parse arguments - split by comma but respect strings - const args: string[] = []; - let current = ""; - let inString = false; - let stringChar = ""; + // Find function calls like: res = autumn.something.method(...) + // We need to find the matching closing paren, accounting for nested brackets + const funcCallPattern = /((?:res\s*=\s*)?autumn\.[a-z_.]+)\(/gi; + let result = code; + let match: RegExpExecArray | null = null; - for (const char of argsStr) { - if ((char === '"' || char === "'") && !inString) { - inString = true; - stringChar = char; + // Process from end to start to preserve indices + const matches: { start: number; end: number; funcCall: string }[] = []; + match = funcCallPattern.exec(code); + while (match !== null) { + const funcCall = match[1]; + const argsStart = match.index + match[0].length; + + // Find the matching closing paren + let depth = 1; + let i = argsStart; + let inString = false; + let stringChar = ""; + + while (i < code.length && depth > 0) { + const char = code[i]; + const prevChar = i > 0 ? code[i - 1] : ""; + + if ((char === '"' || char === "'") && !inString && prevChar !== "\\") { + inString = true; + stringChar = char; + } else if (char === stringChar && inString && prevChar !== "\\") { + inString = false; + stringChar = ""; + } else if (!inString) { + if (char === "(" || char === "[" || char === "{") { + depth++; + } else if (char === ")" || char === "]" || char === "}") { + depth--; + } + } + i++; + } + + if (depth === 0) { + matches.push({ + start: match.index, + end: i, + funcCall, + }); + } + match = funcCallPattern.exec(code); + } + + // Process matches from end to start + for (let m = matches.length - 1; m >= 0; m--) { + const { start, end, funcCall } = matches[m]; + const argsStr = code.slice(start + funcCall.length + 1, end - 1); + + // Parse top-level arguments - split by comma but respect strings and nested brackets + const args: string[] = []; + let current = ""; + let inString = false; + let stringChar = ""; + let bracketDepth = 0; + + for (let j = 0; j < argsStr.length; j++) { + const char = argsStr[j]; + const prevChar = j > 0 ? argsStr[j - 1] : ""; + + if ((char === '"' || char === "'") && !inString && prevChar !== "\\") { + inString = true; + stringChar = char; + current += char; + } else if (char === stringChar && inString && prevChar !== "\\") { + inString = false; + stringChar = ""; + current += char; + } else if (!inString) { + if (char === "(" || char === "[" || char === "{") { + bracketDepth++; current += char; - } else if (char === stringChar && inString) { - inString = false; - stringChar = ""; + } else if (char === ")" || char === "]" || char === "}") { + bracketDepth--; current += char; - } else if (char === "," && !inString) { + } else if (char === "," && bracketDepth === 0) { args.push(current.trim()); current = ""; } else { current += char; } + } else { + current += char; } - if (current.trim()) { - args.push(current.trim()); - } + } + if (current.trim()) { + args.push(current.trim()); + } - // If 2 or fewer args and short enough, keep on one line - const singleLine = `${funcCall}(${args.join(", ")})`; - if (args.length <= 2 && singleLine.length <= 60) { - return singleLine; - } + // If 2 or fewer simple args and short enough, keep on one line + const hasComplexArg = args.some( + (arg) => arg.includes("[") || arg.includes("{") || arg.includes("\n"), + ); + const singleLine = `${funcCall}(${args.join(", ")})`; + if (args.length <= 2 && singleLine.length <= 60 && !hasComplexArg) { + result = result.slice(0, start) + singleLine + result.slice(end); + continue; + } - // Format with each arg on its own line - const indent = " "; - const formattedArgs = args.map((arg) => `${indent}${arg},`).join("\n"); - return `${funcCall}(\n${formattedArgs}\n)`; - }, - ); + // Format with each arg on its own line, properly indenting nested structures + const indent = " "; + const formattedArgs = args + .map((arg) => { + // If arg contains nested structures, re-indent them + if (arg.includes("\n")) { + const lines = arg.split("\n"); + const reindented = lines + .map((line, lineIndex) => { + if (lineIndex === 0) { + return `${indent}${line.trim()}`; + } + // Preserve relative indentation of nested content + const trimmed = line.trimStart(); + const originalIndent = line.length - line.trimStart().length; + // Calculate how many levels deep this line is (each level = 4 spaces) + const levels = Math.floor(originalIndent / 4); + return `${indent}${indent.repeat(levels)}${trimmed}`; + }) + .join("\n"); + return `${reindented},`; + } + return `${indent}${arg},`; + }) + .join("\n"); + const formatted = `${funcCall}(\n${formattedArgs}\n)`; + result = result.slice(0, start) + formatted + result.slice(end); + } + + return result; } /** diff --git a/packages/openapi/v2.1/contracts/billingContract.ts b/packages/openapi/v2.1/contracts/billingContract.ts index 4063e88d9..12940b197 100644 --- a/packages/openapi/v2.1/contracts/billingContract.ts +++ b/packages/openapi/v2.1/contracts/billingContract.ts @@ -7,6 +7,8 @@ import { ExtUpdateSubscriptionV1ParamsSchema, OpenCustomerPortalParamsV1Schema, OpenCustomerPortalResponseSchema, + SetupPaymentParamsSchema, + SetupPaymentResultSchema, } from "@autumn/shared"; import { oc } from "@orpc/contract"; import { @@ -185,3 +187,38 @@ export const billingOpenCustomerPortalContract = oc ], }), ); + +export const billingSetupPaymentContract = oc + .route({ + method: "POST", + path: "/v1/billing.setup_payment", + operationId: "setupPayment", + tags: ["billing"], + description: + "Create a payment setup session for a customer to add or update their payment method.", + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "setupPayment", + }), + }) + .input( + SetupPaymentParamsSchema.meta({ + title: "SetupPaymentParams", + examples: [ + { + customer_id: "cus_123", + success_url: "https://example.com/account/billing", + }, + ], + }), + ) + .output( + SetupPaymentResultSchema.meta({ + examples: [ + { + customer_id: "cus_123", + payment_url: "https://checkout.stripe.com/...", + }, + ], + }), + ); diff --git a/packages/openapi/v2.1/contracts/index.ts b/packages/openapi/v2.1/contracts/index.ts index 8eb7defa1..d35032e56 100644 --- a/packages/openapi/v2.1/contracts/index.ts +++ b/packages/openapi/v2.1/contracts/index.ts @@ -10,6 +10,7 @@ import { billingOpenCustomerPortalContract, billingPreviewAttachContract, billingPreviewUpdateContract, + billingSetupPaymentContract, billingUpdateContract, } from "./billingContract.js"; import { @@ -34,7 +35,13 @@ import { listFeaturesContract, updateFeatureContract, } from "./featuresContract.js"; -import { listPlansContract } from "./plansContract.js"; +import { + createPlanContract, + deletePlanContract, + getPlanContract, + listPlansContract, + updatePlanContract, +} from "./plansContract.js"; import { referralsCreateCodeContract, referralsRedeemCodeContract, @@ -48,7 +55,11 @@ export const v2_1ContractRouter = oc.router({ deleteCustomer: deleteCustomerContract, // Plans - listPlans: listPlansContract, + plansCreate: createPlanContract, + plansGet: getPlanContract, + plansList: listPlansContract, + plansUpdate: updatePlanContract, + plansDelete: deletePlanContract, // Features featuresCreate: createFeatureContract, @@ -63,6 +74,7 @@ export const v2_1ContractRouter = oc.router({ billingUpdate: billingUpdateContract, billingPreviewUpdate: billingPreviewUpdateContract, billingOpenCustomerPortal: billingOpenCustomerPortalContract, + billingSetupPayment: billingSetupPaymentContract, // Balances balancesCreate: balancesCreateContract, diff --git a/packages/openapi/v2.1/contracts/plansContract.ts b/packages/openapi/v2.1/contracts/plansContract.ts index 282b7dfd6..61a1de87b 100644 --- a/packages/openapi/v2.1/contracts/plansContract.ts +++ b/packages/openapi/v2.1/contracts/plansContract.ts @@ -1,7 +1,24 @@ -import { ApiPlanV1Schema } from "@api/products/apiPlanV1.js"; -import { ListPlanParamsSchema } from "@api/products/crud/listPlanParams.js"; +import { SuccessResponseSchema } from "@api/common/commonResponses.js"; +import { + API_PLAN_V1_EXAMPLE, + ApiPlanV1WithMeta, +} from "@api/products/apiPlanV1.js"; +import { + CreatePlanParamsV2Schema, + DeletePlanParamsV2Schema, + GetPlanParamsV0Schema, + getListResponseSchema, + ListPlanParamsSchema, + UpdatePlanParamsV2Schema, +} from "@autumn/shared"; import { oc } from "@orpc/contract"; -import { z } from "zod/v4"; +import { + createPlanJsDoc, + deletePlanJsDoc, + getPlanJsDoc, + listPlansJsDoc, + updatePlanJsDoc, +} from "../jsDocs/planJsDocs.js"; export const listPlansContract = oc .route({ @@ -9,15 +26,186 @@ export const listPlansContract = oc path: "/v1/plans.list", operationId: "listPlans", summary: "List all plans", + description: listPlansJsDoc, tags: ["plans"], spec: (spec) => ({ ...spec, "x-speakeasy-name-override": "list", }), }) - .input(ListPlanParamsSchema) + .input( + ListPlanParamsSchema.meta({ + title: "ListPlansParams", + examples: [{}, { customer_id: "cus_123" }, { include_archived: true }], + }), + ) .output( - z.object({ - list: z.array(ApiPlanV1Schema), + getListResponseSchema({ schema: ApiPlanV1WithMeta }).meta({ + examples: [ + { + list: [API_PLAN_V1_EXAMPLE], + }, + ], }), ); + +export const getPlanContract = oc + .route({ + method: "POST", + path: "/v1/plans.get", + operationId: "getPlan", + summary: "Get a plan", + description: getPlanJsDoc, + tags: ["plans"], + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "get", + }), + }) + .input( + GetPlanParamsV0Schema.meta({ + title: "GetPlanParams", + examples: [{ plan_id: "pro_plan" }, { plan_id: "pro_plan", version: 2 }], + }), + ) + .output( + ApiPlanV1WithMeta.meta({ + examples: [API_PLAN_V1_EXAMPLE], + }), + ); + +export const createPlanContract = oc + .route({ + method: "POST", + path: "/v1/plans.create", + operationId: "createPlan", + summary: "Create a plan", + description: createPlanJsDoc, + tags: ["plans"], + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "create", + }), + }) + .input( + CreatePlanParamsV2Schema.meta({ + title: "CreatePlanParams", + examples: [ + { + plan_id: "free_plan", + name: "Free", + auto_enable: true, + items: [ + { + feature_id: "messages", + included: 100, + reset: { interval: "month" }, + }, + ], + }, + { + plan_id: "pro_plan", + name: "Pro Plan", + price: { amount: 10, interval: "month" }, + items: [ + { + feature_id: "messages", + included: 1000, + reset: { interval: "month" }, + price: { + amount: 0.01, + interval: "month", + billing_units: 1, + billing_method: "usage_based", + }, + }, + ], + }, + { + plan_id: "team_plan", + name: "Team Plan", + price: { amount: 49, interval: "month" }, + items: [ + { + feature_id: "seats", + included: 5, + price: { + amount: 10, + interval: "month", + billing_units: 1, + billing_method: "prepaid", + }, + }, + ], + }, + ], + }), + ) + .output( + ApiPlanV1WithMeta.meta({ + examples: [API_PLAN_V1_EXAMPLE], + }), + ); + +export const updatePlanContract = oc + .route({ + method: "POST", + path: "/v1/plans.update", + operationId: "updatePlan", + summary: "Update a plan", + description: updatePlanJsDoc, + tags: ["plans"], + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "update", + }), + }) + .input( + UpdatePlanParamsV2Schema.meta({ + title: "UpdatePlanParams", + examples: [ + { + plan_id: "pro_plan", + name: "Pro Plan (Updated)", + price: { amount: 15, interval: "month" }, + }, + { + plan_id: "pro_plan", + price: null, + }, + { + plan_id: "old_plan", + archived: true, + }, + ], + }), + ) + .output( + ApiPlanV1WithMeta.meta({ + examples: [API_PLAN_V1_EXAMPLE], + }), + ); + +export const deletePlanContract = oc + .route({ + method: "POST", + path: "/v1/plans.delete", + operationId: "deletePlan", + summary: "Delete a plan", + description: deletePlanJsDoc, + tags: ["plans"], + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "delete", + }), + }) + .input( + DeletePlanParamsV2Schema.meta({ + title: "DeletePlanParams", + examples: [ + { plan_id: "unused_plan" }, + { plan_id: "legacy_plan", all_versions: true }, + ], + }), + ) + .output(SuccessResponseSchema); diff --git a/packages/openapi/v2.1/jsDocs/planJsDocs.ts b/packages/openapi/v2.1/jsDocs/planJsDocs.ts new file mode 100644 index 000000000..17f0a1bfd --- /dev/null +++ b/packages/openapi/v2.1/jsDocs/planJsDocs.ts @@ -0,0 +1,258 @@ +import { + CreatePlanParamsV2Schema, + DeletePlanParamsV2Schema, + GetPlanParamsV0Schema, + UpdatePlanParamsV2Schema, +} from "@autumn/shared"; +import { createJSDocDescription, example } from "../../utils/jsDocs/index.js"; + +export const listPlansJsDoc = createJSDocDescription({ + description: "Lists all plans in the current environment.", + whenToUse: + "Use this to retrieve all plans for displaying pricing pages or managing plan configurations.", + examples: [], + methodName: "plans.list", + returns: "A list of all plans with their pricing and feature configurations.", +}); + +export const getPlanJsDoc = createJSDocDescription({ + description: "Retrieves a single plan by its ID.", + whenToUse: + "Use this to fetch the full configuration of a specific plan, including its features and pricing.", + body: GetPlanParamsV0Schema, + examples: [ + example({ + description: "Get a plan by ID", + values: { + planId: "pro_plan", + }, + }), + example({ + description: "Get a specific version of a plan", + values: { + planId: "pro_plan", + version: 2, + }, + }), + ], + methodName: "plans.get", + returns: "The plan object with its full configuration.", +}); + +export const createPlanJsDoc = createJSDocDescription({ + description: + "Creates a new plan with optional base price and feature configurations.", + whenToUse: + "Use this to programmatically create pricing plans. See [How plans work](/documentation/pricing/plans) for concepts.", + body: CreatePlanParamsV2Schema, + examples: [ + example({ + description: "Create a free plan with limited features", + values: { + planId: "free_plan", + name: "Free", + autoEnable: true, + items: [ + { + featureId: "messages", + included: 100, + reset: { interval: "month" }, + }, + ], + }, + }), + example({ + description: "Create a paid plan with base price and usage-based feature", + values: { + planId: "pro_plan", + name: "Pro Plan", + price: { + amount: 10, + interval: "month", + }, + items: [ + { + featureId: "messages", + included: 1000, + reset: { interval: "month" }, + price: { + amount: 0.01, + interval: "month", + billingUnits: 1, + billingMethod: "usage_based", + }, + }, + ], + }, + }), + example({ + description: "Create a plan with prepaid seats", + values: { + planId: "team_plan", + name: "Team Plan", + price: { + amount: 49, + interval: "month", + }, + items: [ + { + featureId: "seats", + included: 5, + price: { + amount: 10, + interval: "month", + billingUnits: 1, + billingMethod: "prepaid", + }, + }, + ], + }, + }), + example({ + description: "Create an add-on plan", + values: { + planId: "analytics_addon", + name: "Advanced Analytics", + addOn: true, + price: { + amount: 20, + interval: "month", + }, + }, + }), + example({ + description: "Create a plan with tiered pricing", + values: { + planId: "api_plan", + name: "API Plan", + items: [ + { + featureId: "api_calls", + included: 1000, + reset: { interval: "month" }, + price: { + tiers: [ + { to: 10000, amount: 0.001 }, + { to: 100000, amount: 0.0005 }, + { to: "inf", amount: 0.0001 }, + ], + interval: "month", + billingUnits: 1, + billingMethod: "usage_based", + }, + }, + ], + }, + }), + example({ + description: "Create a plan with free trial", + values: { + planId: "premium_plan", + name: "Premium", + price: { + amount: 99, + interval: "month", + }, + freeTrial: { + durationLength: 14, + durationType: "day", + cardRequired: true, + }, + }, + }), + ], + methodName: "plans.create", + returns: "The created plan object.", +}); + +export const updatePlanJsDoc = createJSDocDescription({ + description: + "Updates an existing plan. Creates a new version unless `disableVersion` is set.", + whenToUse: + "Use this to modify plan properties, pricing, or feature configurations. See [Adding features to plans](/documentation/pricing/plan-features) for item configuration.", + body: UpdatePlanParamsV2Schema, + examples: [ + example({ + description: "Update plan name and price", + values: { + planId: "pro_plan", + name: "Pro Plan (Updated)", + price: { + amount: 15, + interval: "month", + }, + }, + }), + example({ + description: "Add a feature to an existing plan", + values: { + planId: "pro_plan", + items: [ + { + featureId: "messages", + included: 1000, + reset: { interval: "month" }, + }, + { + featureId: "storage", + included: 10, + reset: { interval: "month" }, + }, + ], + }, + }), + example({ + description: "Remove the base price (make usage-only)", + values: { + planId: "pro_plan", + price: null, + }, + }), + example({ + description: "Archive a plan", + values: { + planId: "old_plan", + archived: true, + }, + }), + example({ + description: "Update feature's included amount", + values: { + planId: "pro_plan", + items: [ + { + featureId: "messages", + included: 2000, + reset: { interval: "month" }, + }, + ], + }, + }), + ], + methodName: "plans.update", + returns: "The updated plan object.", +}); + +export const deletePlanJsDoc = createJSDocDescription({ + description: "Deletes a plan by its ID.", + whenToUse: + "Use this to permanently remove a plan. Plans with active customers cannot be deleted - archive them instead.", + body: DeletePlanParamsV2Schema, + examples: [ + example({ + description: "Delete a plan", + values: { + planId: "unused_plan", + }, + }), + example({ + description: "Delete all versions of a plan", + values: { + planId: "legacy_plan", + allVersions: true, + }, + }), + ], + methodName: "plans.delete", + returns: "A success flag indicating the plan was deleted.", +}); diff --git a/packages/sdk/.speakeasy/code-samples.overlay.yaml b/packages/sdk/.speakeasy/code-samples.overlay.yaml index ac3ab80ff..0807b4428 100644 --- a/packages/sdk/.speakeasy/code-samples.overlay.yaml +++ b/packages/sdk/.speakeasy/code-samples.overlay.yaml @@ -198,6 +198,29 @@ actions: console.log(result); } + run(); + - target: $["paths"]["/v1/billing.setup_payment"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.billing.setupPayment({ + customerId: "cus_123", + successUrl: "https://example.com/account/billing", + }); + + console.log(result); + } + run(); - target: $["paths"]["/v1/billing.update"]["post"] update: @@ -550,6 +573,83 @@ actions: console.log(result); } + run(); + - target: $["paths"]["/v1/plans.create"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.plans.create({ + planId: "free_plan", + name: "Free", + autoEnable: true, + items: [ + { + featureId: "messages", + included: 100, + reset: { + interval: "month", + }, + }, + ], + }); + + console.log(result); + } + + run(); + - target: $["paths"]["/v1/plans.delete"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.plans.delete({ + planId: "unused_plan", + }); + + console.log(result); + } + + run(); + - target: $["paths"]["/v1/plans.get"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.plans.get({ + planId: "pro_plan", + }); + + console.log(result); + } + run(); - target: $["paths"]["/v1/plans.list"]["post"] update: @@ -565,7 +665,34 @@ actions: }); async function run() { - const result = await autumn.plans.list(); + const result = await autumn.plans.list({}); + + console.log(result); + } + + run(); + - target: $["paths"]["/v1/plans.update"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.plans.update({ + planId: "pro_plan", + name: "Pro Plan (Updated)", + price: { + amount: 15, + interval: "month", + }, + }); console.log(result); } diff --git a/packages/sdk/.speakeasy/gen.lock b/packages/sdk/.speakeasy/gen.lock index a068b1a9f..a9864ff18 100644 --- a/packages/sdk/.speakeasy/gen.lock +++ b/packages/sdk/.speakeasy/gen.lock @@ -1,16 +1,16 @@ lockVersion: 2.0.0 id: 7b300647-cd76-49e9-bf77-7d1bf5446d66 management: - docChecksum: 141728d3d3645ccdc68ca4c274415a97 + docChecksum: a79812bb91c354d45a3a47104de16c0f docVersion: 2.1.0 speakeasyVersion: 1.719.0 generationVersion: 2.824.1 - releaseVersion: 0.10.8 - configChecksum: 68e5a3e4e7dbc855a37015e3d9b4f6c8 + releaseVersion: 0.10.15 + configChecksum: 00ac515822ea809846782b6ed12d9c07 persistentEdits: - generation_id: ca7522ab-54e3-4dc9-8aa5-f327f8c567c3 - pristine_commit_hash: 516123c77037f5cbb279fe957e35c8e40e8bc3ec - pristine_tree_hash: a1bbf1f05e75e3ba9efa00b4d5bda5965da2eafa + generation_id: 12abcc41-7f80-471f-9a1f-2a4553fda509 + pristine_commit_hash: eb97f61473ee6dcfe732a64ea2b8d14a9f99dc5c + pristine_tree_hash: 1fe7bcc3b3d53e90d08f09c2a3c7cee26c59fdb4 features: typescript: additionalDependencies: 0.1.0 @@ -148,8 +148,8 @@ trackedFiles: pristine_git_object: 8c746b111471fe8bd917852dbea64c219ccf1b32 docs/models/billing-attach-billing-method.md: id: b8065e6e9007 - last_write_checksum: sha1:86e46ef6befe65825f85c0c43b2f2dd6b01b0ade - pristine_git_object: e1d23e8bd480b7f63eace34dc4e4bf7cea8aafec + last_write_checksum: sha1:1ba7d88438747acd7bcb3cef4b014924093d7fed + pristine_git_object: 47e22e39335d95fb36ba6bd8f962dc588bc844fd docs/models/billing-attach-code.md: id: 2fe6307f7f0f last_write_checksum: sha1:72adcc13d2c0f8e0a2c71aa51233ae45adddd295 @@ -172,20 +172,20 @@ trackedFiles: pristine_git_object: b39eb5467b48d4ab4ee88961bacf46c36a5b1f2b docs/models/billing-attach-duration-type.md: id: a223ca393687 - last_write_checksum: sha1:33afcef75e572dbb66975dd0868efcc3256c3ad2 - pristine_git_object: a94cab6cc44c89905fb0ecd494f00bbe51384647 + last_write_checksum: sha1:da597a832eb2c6fc75c40c36ad0aed2734b17894 + pristine_git_object: 3256d505f70c38d5f8902255a51791e866252d94 docs/models/billing-attach-expiry-duration-type.md: id: c465a9bb3bd3 - last_write_checksum: sha1:60b416eb06e86d946b9b85f9b8738b747a2b5c79 - pristine_git_object: e16b20e54ae6214f4d5cfdd24dc27e1a98a792e9 + last_write_checksum: sha1:0fd891c6002074662d9911894509eccc6c31dd65 + pristine_git_object: e2e0d2c3b393f6bf5a7b8ac22e7a69a648f8afc0 docs/models/billing-attach-feature-quantity.md: id: e25424416a8f last_write_checksum: sha1:14a67df04e74b6d332616014d764b33a69f88236 pristine_git_object: 1e4cab2648560d39bc880d55d597f8dd50cb4284 docs/models/billing-attach-free-trial.md: id: c39a4c880f22 - last_write_checksum: sha1:5f7edb1bd6f73f0867489ca5a3c65ccc07b52984 - pristine_git_object: e0a6c6a13a43e80e9de56823057cb4defcaa90fa + last_write_checksum: sha1:3ad3e51c51ef9c204b0b2ba5b7159294b8e28fa3 + pristine_git_object: 8833a7da2fe0f519bb4022135257bb8716a19fd8 docs/models/billing-attach-globals.md: id: 64a91dfd79f3 last_write_checksum: sha1:fe5a8e304ab3c547505a8bf18efaa04b87622e6e @@ -200,60 +200,60 @@ trackedFiles: pristine_git_object: be6a8d739890cf7edccf5d6c29dd28a93688966e docs/models/billing-attach-item-price-interval.md: id: d850bef7cef5 - last_write_checksum: sha1:b08ab3ff8aecfb990d53398e36a403b8ff357b93 - pristine_git_object: 49eca39a42ce2d1b18a7c8e0db935d7bc20ab42c + last_write_checksum: sha1:cbfd1e5b9807a820e12e595cbf30116e4a3acb88 + pristine_git_object: 867bd77fb531de8da3a5c716c743a26fb3589938 docs/models/billing-attach-item-price.md: id: 2a5033fb6ce1 - last_write_checksum: sha1:baa0a5a2bd1baed498715504db46c02be3d29bfe - pristine_git_object: 010673667dda02992ba11b723f3c2e0bcc3981dc + last_write_checksum: sha1:a7075b98596c6a15f872894433ac46b26ca339a4 + pristine_git_object: 441b4c46256be15966bc4adbe7fcb1e5b89da5bf docs/models/billing-attach-item.md: id: 683cdd6544af - last_write_checksum: sha1:a1318956e394006e60f28d872d507e61f4d12bd5 - pristine_git_object: a3fd13d002800c6e24d3b2b631c8edee0c17f007 + last_write_checksum: sha1:b79fb320a4e0622e3ad37fc5babd5b4d22f23438 + pristine_git_object: 54fc76810b63a5b2eef5fe32414e3de528a8714c docs/models/billing-attach-on-decrease.md: id: a0df076b62ab - last_write_checksum: sha1:082c5a6c310edfb4ab2f8b8a8e9def1ad03a1b7b - pristine_git_object: fa3fe198219a5634bb86c95afd7f431763a3bc3b + last_write_checksum: sha1:da8f8b6f204a1b80e40408140f6ff7d577b19b06 + pristine_git_object: df06a306a9c26abe75c78c5f7c030bd4f9d9a0ca docs/models/billing-attach-on-increase.md: id: 4a8d71f2d507 - last_write_checksum: sha1:39933cbb0849e2d909c21e21ec14de3d6dbecbac - pristine_git_object: b299a19afdb47800bd68273aec509276fea92db4 + last_write_checksum: sha1:46abd81b456a5523c0baea5229bdb25a0fe89b13 + pristine_git_object: 8d175b5f32d0ab5258d3603569c81faa99487eb2 docs/models/billing-attach-plan-schedule.md: id: 7a4dcb0f0bdd last_write_checksum: sha1:fb709e50c297d93f3e8e5a4d591dba75e10a1e57 pristine_git_object: 680bc5881639a23850a074e5f23662aed1cc91d7 docs/models/billing-attach-price-interval.md: id: 45cebd3dbe41 - last_write_checksum: sha1:25d6912322122847f26a7dfd591d1807ddce332d - pristine_git_object: 76dfdb9c5621d2431afaa7f468aa0cb8781edb3a + last_write_checksum: sha1:89fbad284ec67e221dcac5399e5e9ac3248e6cfe + pristine_git_object: 1a90db121ffd1e2ce0d5e01847600a62199e35d4 docs/models/billing-attach-price.md: id: 5f6ce9e5f50b - last_write_checksum: sha1:b20a54dcd6880c63ebae6d09f96cb05ee10cb39e - pristine_git_object: b903dbde0a633f7fbe31e0883880573a738ac76d + last_write_checksum: sha1:742cd2c8dc6fc33f73dc43fb3d9af5846db58918 + pristine_git_object: 3913182fa705acd414ee39fe7fd576e490d797a3 docs/models/billing-attach-proration.md: id: cedfbc549872 - last_write_checksum: sha1:fe283745a679a4b5b353aa2a3eb989c682b5ed7a - pristine_git_object: 3715830c1bebb2cb78f511ba04343488c70a091d + last_write_checksum: sha1:c2290356ae004e00cb051d8434027388229dee2d + pristine_git_object: c4a19c72c217744ba882bd0e3c91e96aa9af9550 docs/models/billing-attach-required-action.md: id: 8ba37f3620e5 last_write_checksum: sha1:67b02b42800df13a6fc74e9c4c16a4377d202185 pristine_git_object: 5fd1fcd0d815e8fc09a3bfbee27698bab7f498c8 docs/models/billing-attach-reset-interval.md: id: 30540d7bd936 - last_write_checksum: sha1:0ef035e8d9c8b08775697e4291d4e683d5eb6212 - pristine_git_object: 35cec40f225298db5f0f1d9e383283c54bacea96 + last_write_checksum: sha1:d755a3ebe19b2b3410b5e99ca16df1ff4edfa1d7 + pristine_git_object: f6544ea687436f2bc126951af1d62780b06e40fb docs/models/billing-attach-reset.md: id: 196d799dde8c - last_write_checksum: sha1:268feebcbe5f8203175596bee5de38d9662862eb - pristine_git_object: 1c1f2244b478e7f1a7c5b0edf1f1f3b1828535d9 + last_write_checksum: sha1:dccfb35d4ac8fce3fe5d3902e9468ac68cb21a30 + pristine_git_object: 48c99528c3dc7fce2639d9c32bc9108a63fa91fe docs/models/billing-attach-response.md: id: 616a6ac6b11b last_write_checksum: sha1:1f76d92fb7678a41de1f91a2d7764b148f559f5b pristine_git_object: f747a42c8125796546ba3fbf103f479d7b6a3d54 docs/models/billing-attach-rollover.md: id: 62a8f718c040 - last_write_checksum: sha1:1fe18d84194a880a1ea51ea9dbce5804fc17b2ab - pristine_git_object: 6fd6c72b7bc0ba0b2c19fbbee179fa4d0c774b42 + last_write_checksum: sha1:6ffbd787ac740ba3639444a8e1c3fea8c3826cf3 + pristine_git_object: dcc8b723d3677f0766471da6826a7b18ba9f729e docs/models/billing-attach-tier.md: id: 93546751245e last_write_checksum: sha1:a055880ac4c4c48fee2948c096662d6d33797244 @@ -268,8 +268,8 @@ trackedFiles: pristine_git_object: 68874c9e1da701993b0d8c86fcddf0814d536872 docs/models/billing-update-billing-method.md: id: 7fa432ebb343 - last_write_checksum: sha1:489c66a6dafa3cf82e51239c94e1b75b51ceca72 - pristine_git_object: cf04e983d7bf89ea5eb1cf43834caf82734f49d6 + last_write_checksum: sha1:17f53127f8d8ec1a7828bf149b6c791027bacb83 + pristine_git_object: 5d58027780f60cd71cedb9342151381034f85539 docs/models/billing-update-cancel-action.md: id: ab5cbabb3639 last_write_checksum: sha1:eb8165b2ea9a086c00f8153a69661852e8743663 @@ -284,20 +284,20 @@ trackedFiles: pristine_git_object: 3155a23f41866237cce1467ef8b360c12b4abb2c docs/models/billing-update-duration-type.md: id: f711ec227260 - last_write_checksum: sha1:1f658a150a3f09c6a9779127d147b86643ea21af - pristine_git_object: 70965bba3553b232c1566f148829afbf2ce0f43d + last_write_checksum: sha1:98a5be59f2473d00d1b58725a918223ab19fa8dc + pristine_git_object: 5cee91272afa68676ef3ce10fb97f07a42fca6b7 docs/models/billing-update-expiry-duration-type.md: id: 827a3d465f45 - last_write_checksum: sha1:54a26a4b6d94edd5abe5bf4e46395d0025ae78f4 - pristine_git_object: b1b13de32a3c725cdaa512629214bdf742bd0b5b + last_write_checksum: sha1:ec2cde39492d2b6da480c3217b462e9e1fd80ace + pristine_git_object: 514847814aca9ef789f03a117d487f114c5964a2 docs/models/billing-update-feature-quantity.md: id: 7a157e142f2d last_write_checksum: sha1:b4a3f0366b074b9655e53ff369106447a0db9e1d pristine_git_object: b00a0ce49bbb5a7f69f9f1941943a195a09caaa1 docs/models/billing-update-free-trial.md: id: 1dbc7560f2d4 - last_write_checksum: sha1:de03b7b137619dbcd6624b922920f81c88491c6e - pristine_git_object: 14c590858eb496d9e1a294a19c0198461bb2ae19 + last_write_checksum: sha1:615d474a4e7e41347d6e269392c88c8f2c6a16af + pristine_git_object: 899dfe7ddd8af3bc9718a8e243b89173a93e10ed docs/models/billing-update-globals.md: id: 77f718b86108 last_write_checksum: sha1:944990596aaf33c8cf2bddcfe7678d4200ab7aa8 @@ -312,56 +312,56 @@ trackedFiles: pristine_git_object: 13271e1570d542c4f7f1e9b3202d81999e16c147 docs/models/billing-update-item-price-interval.md: id: 63d4ab432124 - last_write_checksum: sha1:4daa0ff655391276595bae9a512e3d68632fe314 - pristine_git_object: 327ed65b83b049b568125077654cfb5c748f1887 + last_write_checksum: sha1:18dde4b421b50f240d5ffaf23c038bdb7b138bcf + pristine_git_object: 116ca195cbe43ef0b876278fb8c5b7c20f1e46fb docs/models/billing-update-item-price.md: id: 394a0a1cba93 - last_write_checksum: sha1:dd474774541faec6d0eb87c2e65fead93726ec8b - pristine_git_object: 02504270ee42f9d36133496f2979200a2b73a9c3 + last_write_checksum: sha1:4e3f8b1996e2b5f1a5c22f10565f269381086724 + pristine_git_object: fdb027e2395713dc076ea832d70d16bd55b64328 docs/models/billing-update-item.md: id: f50e6ab64c4c - last_write_checksum: sha1:96f12e623f27d10a63a91faaeec681a1212a9a1d - pristine_git_object: 66c0c5a91fc25841968456f6dd29fe17e487f735 + last_write_checksum: sha1:7cbe58f7288eb9e05b61b800bba1bacf32e5354e + pristine_git_object: 68430ea1d1531d595dea81ebee99acdea0a1a37a docs/models/billing-update-on-decrease.md: id: ab016b627d29 - last_write_checksum: sha1:adea48875e5b83252fa26a2c9dfe68e984037b6b - pristine_git_object: e6cc3b9fb700f307a0a80fe9f231830f0ade63c4 + last_write_checksum: sha1:54b08140b9d4d48346e78c6ca8fd0782485bc665 + pristine_git_object: e2ce12d32670819ce8847f76b9597932519d99dc docs/models/billing-update-on-increase.md: id: 441fa5886657 - last_write_checksum: sha1:b4429720f47296f8924864ef9ea0ebc6d7473cd2 - pristine_git_object: 8754e710de57b2e97a5d7b43b295aab39ad5c60b + last_write_checksum: sha1:b5051b57201ba89aabb74d128c84f362d39a9f98 + pristine_git_object: 873c3fb310d055b73d9ac822e9118b41e8834e59 docs/models/billing-update-price-interval.md: id: 37ffd299355f - last_write_checksum: sha1:d1abf723ab799db591162b46ebd487a2f5115fc5 - pristine_git_object: 9b44ee082a852d5b656211e7f4f131cfb2612545 + last_write_checksum: sha1:13691ac769a15a7a54173e67c1745bfc1c17b0f0 + pristine_git_object: 512381bc87ada061d18ea171aae5fe87d700a41b docs/models/billing-update-price.md: id: 656951a74af3 - last_write_checksum: sha1:33a9eb6f30d0f8c44a199228ffb5ee088a1f8006 - pristine_git_object: 15952b398acdf5a3e54eba6a83af818d1d2a9dfd + last_write_checksum: sha1:45cc068522b0ec24b42bc610709c362dc34a2bbe + pristine_git_object: 899b4d5afcf095a83fa914a7543c2b7db1f1a84a docs/models/billing-update-proration.md: id: fcbf404063bc - last_write_checksum: sha1:16c2ae0fd826818098a137d0fe8b4a93c7b6598f - pristine_git_object: d21ea7ddeec02d3d27542b7fe435fd4d3491f2bc + last_write_checksum: sha1:13335299452527b6e5accf8440600cc12bdcdc3d + pristine_git_object: 36cdcc2b2d8a6a60d11ca36deac68d8f30b97d18 docs/models/billing-update-required-action.md: id: bf7357d5d4cb last_write_checksum: sha1:a32fbd281486508857937d2eab1e6c3ecc6e06d0 pristine_git_object: 038687e11b22142d0c2e341e60245e8172814595 docs/models/billing-update-reset-interval.md: id: 5e20b42507bc - last_write_checksum: sha1:6fa39832434557ceed033ee80a4568f6bbf6a8c7 - pristine_git_object: 191bcacbf28faaf95d8973ea67195fce8258bd77 + last_write_checksum: sha1:73f10448000b630f127e6880c381cdc0ed197d55 + pristine_git_object: 11c3d5a2189a521752585941454e2112ca0feed7 docs/models/billing-update-reset.md: id: 3140f48f0cda - last_write_checksum: sha1:e4950a933a797383c99fbed1077e8613070ebb32 - pristine_git_object: 74108db68aa17591614ecd245e5efcb1d5051a34 + last_write_checksum: sha1:f975d909478344a38cfc8dc53f6d074557ded34a + pristine_git_object: c30be84a9ed470d5ee85aca48cdfca22673c6daf docs/models/billing-update-response.md: id: 30bde576ea05 last_write_checksum: sha1:250f8d222eb3ad2c005732882c0a00d7852c31f9 pristine_git_object: 7b55206b3f362f48b2cfb4e0462c940b2de1afac docs/models/billing-update-rollover.md: id: b8d649352b96 - last_write_checksum: sha1:78399e0cc18376b67a0274c430aa53b9ad898710 - pristine_git_object: 7bcaef54f3cf0cd0a50e629b5544522acde103da + last_write_checksum: sha1:08262275ecabfe3889d8569c05ef060a538067fd + pristine_git_object: 495c3c6fa4a4df8c6ec7af9e27ff149d984c2c71 docs/models/billing-update-tier.md: id: 28b5b060baf0 last_write_checksum: sha1:164379520b922e006296e4ec2fa7a67613f8e636 @@ -426,10 +426,6 @@ trackedFiles: id: e0c3715cbbae last_write_checksum: sha1:8884d4c48d4ac86323f1c42a09610722113cf46c pristine_git_object: c659c5a5a8df3ae58a7a467f513a905104e32cb6 - docs/models/check-scenario.md: - id: 22b128408941 - last_write_checksum: sha1:104762f74c3cf7f795c7bfa056adeecbb4feee2b - pristine_git_object: 3d89a3dd6dc3e7143f44e7ac736018130ae18ca9 docs/models/check-to.md: id: 7df7c9903cc0 last_write_checksum: sha1:5ea0073af130ffb58ba731abe24142cf69496d44 @@ -530,6 +526,170 @@ trackedFiles: id: ec96747ac5a8 last_write_checksum: sha1:e8300fd82a995fb3db3c08fed4ee600222210174 pristine_git_object: 13c8499a703b03b5aaf94deb471298fc8f4ccfe3 + docs/models/create-plan-billing-method-request.md: + id: 5910c31fbd40 + last_write_checksum: sha1:f760605fbcf453ca76282db0ceb6c56dc471198c + pristine_git_object: 881afe6799b816389f7726b398c8703a5b43a1eb + docs/models/create-plan-billing-method-response.md: + id: 4b62f4430e70 + last_write_checksum: sha1:760f8f63af3a0d880434489aff0ec69274205ac2 + pristine_git_object: c23b3e14cc3a3237db918db21e5a166f8948cd1b + docs/models/create-plan-credit-schema.md: + id: 213fe4cef877 + last_write_checksum: sha1:9a9109b25682ec0ed4db881cf449e6ed823eb124 + pristine_git_object: 35385d13f46a0997eb47a1d7c27ae5a26fa60cae + docs/models/create-plan-duration-type-request.md: + id: db52ff12640b + last_write_checksum: sha1:fac917acc26137ab222e20e97f0ce936274fb9f6 + pristine_git_object: 61eda90ca32639a989eab7ac744fa9aef0f827f6 + docs/models/create-plan-duration-type-response.md: + id: 7037528d7fd6 + last_write_checksum: sha1:b9ca0bae4d08cd78deb0a63ce58c057409101ef9 + pristine_git_object: 77c170b36f706ff57cdd83edd6fd9be065251695 + docs/models/create-plan-env.md: + id: 6cc4a7432037 + last_write_checksum: sha1:f5bfb3f0cface216095c8113fecfb6ed7b847698 + pristine_git_object: 54bc47b8d3d4e60a3f95f324a87aa2598da3ac62 + docs/models/create-plan-expiry-duration-type-request.md: + id: 64f50835e6bb + last_write_checksum: sha1:5567b9305c2c0a0eb6a0507b62b5f1dc8569dfe9 + pristine_git_object: e24e9550a7967f519354812a14490b5a2e6c3840 + docs/models/create-plan-expiry-duration-type-response.md: + id: c2e3d11324b4 + last_write_checksum: sha1:1163d8ba2d805ad45b966c6b463d3b0bb5ffa1c1 + pristine_git_object: 0e763d963d9478e1f59b696cef39340d701019ab + docs/models/create-plan-feature-display.md: + id: 77c8a90679b3 + last_write_checksum: sha1:fbc637093c69e128250e5fc72e48dfc2ac319418 + pristine_git_object: 0fd38509c7cecd882e9a0c9af401cff6a0153add + docs/models/create-plan-feature.md: + id: f14d479028b3 + last_write_checksum: sha1:5c5cc7c71299177994b04ac2d9af759a4371d8e0 + pristine_git_object: 758f5a8c58604783a322901e3dd9d09617f14e24 + docs/models/create-plan-free-trial-request.md: + id: 1520ade17141 + last_write_checksum: sha1:45428e78ac1063c28ce399d19420701e8a0822a4 + pristine_git_object: 4424eab3adbb398b1101713d17344ca7d6178f55 + docs/models/create-plan-free-trial-response.md: + id: 273d7c959493 + last_write_checksum: sha1:8c8027c31d22426e2960b565854ae04dc8183990 + pristine_git_object: 5e9e1c2c44ae3bd41b711f049b14e2ff4940888d + docs/models/create-plan-globals.md: + id: 45e788df0576 + last_write_checksum: sha1:6b8aaba89644dd836d83ea6dbfe9523923d5ce39 + pristine_git_object: 0a9b2c98b60da862def051c0e35f9c21a886e206 + docs/models/create-plan-item-display.md: + id: 13cbfeba39b2 + last_write_checksum: sha1:c204040826dd220174269e41645e08586d2968d2 + pristine_git_object: 85d51c73bae5a558f84bba9ae51c7f18ed9cf1f7 + docs/models/create-plan-item-price-interval-request.md: + id: 358402a891d2 + last_write_checksum: sha1:ad8c021d5db96fba5ce04e0aae03ce94880a9c1f + pristine_git_object: e7e6a8e39482cc4fea622616320d6e60c221971b + docs/models/create-plan-item-price-request.md: + id: 27895133faf5 + last_write_checksum: sha1:1c81da712ca15c91a9fbf5e099ea472b8c3e058d + pristine_git_object: 9e9af3a94899eac448dbf9776973268ee4c87159 + docs/models/create-plan-item-price-response.md: + id: 9ef4d0695a07 + last_write_checksum: sha1:16637faf6a0b1c2a23b83207d6f579d15a2be241 + pristine_git_object: c4af69da86cdc8cb1e75fbd62bb047c4a74eb38a + docs/models/create-plan-item-request.md: + id: 7a3d025bbd56 + last_write_checksum: sha1:f7b90ff6bc917cd1f246ad62d588a051c452fddc + pristine_git_object: 73930876af6ca93642e93cfc39a58f92891f0ae5 + docs/models/create-plan-item-response.md: + id: 2c09fc4d0b41 + last_write_checksum: sha1:2d260778bd36be93c59d105eb1a9806a8d98e20d + pristine_git_object: 7ece6d43f8d72bbc6a2ca86705f5b389ee4a8923 + docs/models/create-plan-on-decrease.md: + id: 2a3ce903ad67 + last_write_checksum: sha1:2e1a26eee36104c765ee64a45b5667d4a36e0a8e + pristine_git_object: ed196ac39fa3109d567dfdf573518e5aa15ab058 + docs/models/create-plan-on-increase.md: + id: c42d3cb2cff3 + last_write_checksum: sha1:fe3717af7e1f465d818356daf9fc303a3fb01913 + pristine_git_object: 4636c8e7bc514c5398be5f2af59d18fcf652cfd3 + docs/models/create-plan-params.md: + id: 9570d70789a1 + last_write_checksum: sha1:41a92c971ee659d2accb98860c0ac6d6f90eb59b + pristine_git_object: 1ae5baa750da3797815014d68956fd989ccc1fc8 + docs/models/create-plan-price-display.md: + id: a9f0ab44c193 + last_write_checksum: sha1:520bfd5d1b3dff4b94c38ddb6c22b4cc2061c604 + pristine_git_object: d5cd57a4a8155d518e7bb2762a925f618c6fb9d2 + docs/models/create-plan-price-interval-request.md: + id: dbcf5b1fbaac + last_write_checksum: sha1:cb99d6223798db87f9f07fc4257a54c3a860efed + pristine_git_object: 041e09cef3859854ecdf8997334bfdf94e732cf0 + docs/models/create-plan-price-interval-response.md: + id: 171e588628d3 + last_write_checksum: sha1:a3687969c982d817d27534605aa63fdeed5c3a07 + pristine_git_object: c11dea424b2548d1935a0b217d098380e915e546 + docs/models/create-plan-price-item-interval-response.md: + id: f82a720e74cc + last_write_checksum: sha1:8d3ea30be8b133d51a2524f169108e1bd2bac62d + pristine_git_object: 738eae0ccdfa30004d7a39b67b8a6cf290d1b138 + docs/models/create-plan-price-request.md: + id: ada0d70e716a + last_write_checksum: sha1:1e5c54f88963da99a3cafa25d41bfd0a5b3fd8e6 + pristine_git_object: 3ce15921be092fec1a23f861ab9e4ba71e30da3b + docs/models/create-plan-price-response.md: + id: 9d8f1ded12b9 + last_write_checksum: sha1:256c1600a67e07d069085796baa867d0e8933400 + pristine_git_object: e81f6f4c058dbc462a5ccf8ad1cdb4fd4296b9a9 + docs/models/create-plan-proration.md: + id: b76e93ebb4c1 + last_write_checksum: sha1:aaf8282a06a3cb2e7e12e945596e6fcb9150fb9f + pristine_git_object: 13bec79193ccec28d49424db88530706be331870 + docs/models/create-plan-reset-interval-request.md: + id: 313b5e0e6045 + last_write_checksum: sha1:b9108128c222188659b07d47738efe774dc3e1ff + pristine_git_object: 3ab22b050c282b26f8e10b52d9cb96285e13f734 + docs/models/create-plan-reset-interval-response.md: + id: f48e94cb8d80 + last_write_checksum: sha1:31ade0a5bec7f2706a11c61eaa7b00c01d4925a0 + pristine_git_object: 726d39c72f14a015954d6c7fa610dc56cdbc3df9 + docs/models/create-plan-reset-request.md: + id: d88e31eb9636 + last_write_checksum: sha1:faa2ed1cdae4ae1ff4534b709c718e1a854c7ee8 + pristine_git_object: 4e26ac4eeab4065bf58873f76a3af6b170da6c6b + docs/models/create-plan-reset-response.md: + id: 356903b9ca36 + last_write_checksum: sha1:144b0ded468c23908dc2024442f5be313142e3a2 + pristine_git_object: f99bd3cdd5b9038791efdc0811b61abb4b8c7db9 + docs/models/create-plan-response.md: + id: f48e8b1136af + last_write_checksum: sha1:3851f439fd0687dfa645a0fc8482d2f7a508bedc + pristine_git_object: b853cd66e9b6dfe5bb12945c82a24ab89708d9e3 + docs/models/create-plan-rollover-request.md: + id: 10237b75cd73 + last_write_checksum: sha1:d024a4f706c0ed6332ff255ffc8944b5cce7bc4d + pristine_git_object: fda02ef4e7bf2844c2f324d6f777e4926a1af4ad + docs/models/create-plan-rollover-response.md: + id: b5e9ec426df2 + last_write_checksum: sha1:fc9391a84a8be6a400ac697c9299b87312fd6b6c + pristine_git_object: 5333fae7f3fb953439905529c246d31e90c0837b + docs/models/create-plan-tier-request.md: + id: b61146fcf793 + last_write_checksum: sha1:79a4113f10fcca61645b17599769078181b05aaa + pristine_git_object: 1910aff519ced4a019e3763d6e8856ba6f817387 + docs/models/create-plan-tier-response.md: + id: abb65350cb3f + last_write_checksum: sha1:4d3357d09152023473bb2e8b5a69852380d27e55 + pristine_git_object: 2f7579b433727fca3192eb30a4d0d86cd12508d6 + docs/models/create-plan-to-request.md: + id: d9a64ab7ab26 + last_write_checksum: sha1:53394196e886315b4da09367ca8667c0134c4eb2 + pristine_git_object: cd93e6c51695c50de4e172353ec9a6ed42cbba70 + docs/models/create-plan-to-response.md: + id: e166a2e7b741 + last_write_checksum: sha1:61960c4c90dc8b462484cba4467d2fc063539299 + pristine_git_object: 8f6cb30103a0636e0b338980022f588c1b4b23ed + docs/models/create-plan-type.md: + id: b41ecee1f888 + last_write_checksum: sha1:d68e8655fd6692d7227e237051e746d4704f3055 + pristine_git_object: 6e9be0f142bba31c244a5c9e33b97bedb255f4a2 docs/models/create-referral-code-globals.md: id: 6e32bb0907b2 last_write_checksum: sha1:35e5d951bf5ff283f2c8325e02b597ec695cd0c4 @@ -550,10 +710,6 @@ trackedFiles: id: cbfbb0769db5 last_write_checksum: sha1:5cc7fc548fc238c2c4db1517e1192dc036a74139 pristine_git_object: 1e752c7056ae635cb6bd8aa5a72ee4a95db57ed2 - docs/models/customer-eligibility.md: - id: ca41bb82f9bb - last_write_checksum: sha1:6a02ea635d22ec09a089b5762ea24e221c7e45ad - pristine_git_object: ca0c3e1ce1ea2f60e4cf2206bb9b21e18b9b5997 docs/models/customer-env.md: id: f063b206890c last_write_checksum: sha1:cc47133530e606c040759b3f18b48dad7b78cdae @@ -606,6 +762,18 @@ trackedFiles: id: cf96e3ed57f8 last_write_checksum: sha1:850cac936cf5566ea8726c9dcd2171945f35d654 pristine_git_object: d8f080137e5f9f03c3e7b17a471b28fba254044e + docs/models/delete-plan-globals.md: + id: 6abb65735034 + last_write_checksum: sha1:e7a6f891965a2e50cfc869c56fe49c3f5eff542f + pristine_git_object: 2858c93f8dbf919a1cdbf6db485d1454f9e7b8c8 + docs/models/delete-plan-params.md: + id: d7bf5d42a635 + last_write_checksum: sha1:195d37a0d2862ba5735dc39a9ca9467e6969eb00 + pristine_git_object: d29af20cebc90ba103b269b5ae6a28fbc02f84f5 + docs/models/delete-plan-response.md: + id: 7c90e7fe443e + last_write_checksum: sha1:4b5b143657189009138efa53e5dc5455bdcccb19 + pristine_git_object: 279d06d9980c7356b8767be081fedc85360650c4 docs/models/discount.md: id: 003b28f6c8a6 last_write_checksum: sha1:112f6b32200b8a628007c6bb4d0e130b8540ea22 @@ -628,8 +796,8 @@ trackedFiles: pristine_git_object: 2386a615094cde13c26394cf4ed00fd1c066cdfc docs/models/expiry-duration-type.md: id: 3a927f275515 - last_write_checksum: sha1:7059b0a8efd82cdb43c176b868824f5e26d8eb0c - pristine_git_object: 38df300d40088ea211de7e229c77987ee9d3131a + last_write_checksum: sha1:c3248609945783ebe4b18bff68bec64bb1699694 + pristine_git_object: c622ff90557f1ff06fad783abed2c86415cfd372 docs/models/feature-type.md: id: c6368d6178e0 last_write_checksum: sha1:6505753d40a5ec1a42484e598418b79fe62b1495 @@ -640,8 +808,8 @@ trackedFiles: pristine_git_object: 1d6b973f2eb7216a623c8ee0a41253abd993eacb docs/models/free-trial.md: id: 7d40737b76e3 - last_write_checksum: sha1:ab8208a5a5ab8963a8c8fa7f93dfdd9cd068f6c4 - pristine_git_object: 4600b15c1d50b17c86bfde5df59541dd36c152e1 + last_write_checksum: sha1:60d28a5547f285ac689ec07d10b5faf11a6a7914 + pristine_git_object: f9f3e74e3e6f989e12f5ae4ebbcaf98de2a2e6ff docs/models/get-entity-env.md: id: a0aec49ca920 last_write_checksum: sha1:dccda9677d4762959de028b0008965c35968f846 @@ -706,6 +874,102 @@ trackedFiles: id: 496662dd4c0d last_write_checksum: sha1:5bac80cea5c986ca03ff3d732070e618c39663f9 pristine_git_object: 570053b312dc0a87a05f1b71f815fae814697a7f + docs/models/get-plan-billing-method.md: + id: 81d8a111a09a + last_write_checksum: sha1:af53690dcbacd8d9de1b8d0fd3ffc8d84b9bffc6 + pristine_git_object: f5768604cf8923efd72ddd1d24c7bae63b4a01e2 + docs/models/get-plan-credit-schema.md: + id: fdfd3a232487 + last_write_checksum: sha1:bda036d0335542dc4bea36444ead3b4d1fc31c6b + pristine_git_object: d0de73aba38136ebb18f8bdf83d8ebd29c861406 + docs/models/get-plan-duration-type.md: + id: b69c3a89ed38 + last_write_checksum: sha1:4d302f73a60464b04f4e308e464d3011868b3a55 + pristine_git_object: 08738e384e682b3df3764eede7f159535456fd11 + docs/models/get-plan-env.md: + id: 9c45998ac325 + last_write_checksum: sha1:890b15667716ff79fff0baa98d50fec4f9a963e3 + pristine_git_object: 502bfcc4939437519274d07cd5fa6c5bbd0dd091 + docs/models/get-plan-expiry-duration-type.md: + id: 206c98bb07a5 + last_write_checksum: sha1:c348f23836894aa52e0c31d388e30281efe2d4d9 + pristine_git_object: 0b633db6c9efd1cf814354322813f0082081f213 + docs/models/get-plan-feature-display.md: + id: 5cc0dba3045a + last_write_checksum: sha1:6e2a60793ef7e7a29f48b393ccc01d72643ea9a9 + pristine_git_object: 8af89a51703812741a7bf6997e05ccc2ba22eb1d + docs/models/get-plan-feature.md: + id: bfd5a7be6e92 + last_write_checksum: sha1:4b0ec3314da3c86aa9528e77b18f7edb8a397094 + pristine_git_object: 4635d872bdb036238f616d66282581fb78e72db2 + docs/models/get-plan-free-trial.md: + id: aced636fd2ed + last_write_checksum: sha1:9fccbf5ee36db206a889e17bde39e67ce4463fd6 + pristine_git_object: a50b8985fa83fab9efd3c8b294272ca1cdc248c0 + docs/models/get-plan-globals.md: + id: 4ae71573472e + last_write_checksum: sha1:d03ca83750eea1e6cba2f262e1e3494580b3f89c + pristine_git_object: 4f5fa47bad7cf704b9d168554a228f83cc2aa7de + docs/models/get-plan-item-display.md: + id: e9ba7c6bf49b + last_write_checksum: sha1:11c967c3fc8ca162dbd022ad7d4e84da524ce42e + pristine_git_object: 1e3256b2142d09290462243145af29ca3e0e1590 + docs/models/get-plan-item-price.md: + id: 861928cd4da1 + last_write_checksum: sha1:785a26e9ea696016718d4c5574c9841bb044d7dc + pristine_git_object: 812fbaf6fe045e8f726af1dfeece30f35ab77c77 + docs/models/get-plan-item.md: + id: d1f1aa0f9dc6 + last_write_checksum: sha1:2e0a987df242117cc9b9809e4a8b3ba89bb8cce4 + pristine_git_object: d11f0c5ca0b747fee96b5715ddc8dc86247fd7be + docs/models/get-plan-params.md: + id: 9c87a0826fbb + last_write_checksum: sha1:6c5ddf3267c512ab407e39d34364c021c9842a09 + pristine_git_object: 9b24cbd37d7c0e6640e03be775c0fd85e1809d15 + docs/models/get-plan-price-display.md: + id: 643716d7ce81 + last_write_checksum: sha1:2349e153ea759d0119ce2cdff6e61dd39ea66d50 + pristine_git_object: a385e4971e5561943d86db76c3bf11fb6f024a54 + docs/models/get-plan-price-interval.md: + id: 9c62d7ee142b + last_write_checksum: sha1:6a0e5cdaeb26bb7886e0a60f2ba76b4420ab1669 + pristine_git_object: 63a258d288c8a45cf55600b5ebbd1c6c6d64f1cf + docs/models/get-plan-price-item-interval.md: + id: a6f9d83e7977 + last_write_checksum: sha1:a4d16145daa8c651ecb1021f7676edf990a25c0b + pristine_git_object: af0c14090c03fda28711dadd99a1f54bba08141c + docs/models/get-plan-price.md: + id: c023219918c5 + last_write_checksum: sha1:df9fad9b9570fbc20e35f04904f7cdc72bc471fb + pristine_git_object: 8cfac5aa0600ecd1b8a5824bdfa278901ef66195 + docs/models/get-plan-reset-interval.md: + id: 1946366bc337 + last_write_checksum: sha1:d14fb798d8a7653d86ab2aea1172817e78260352 + pristine_git_object: 56d62f31decd85f39503c155e8d285add8b8918c + docs/models/get-plan-reset.md: + id: 271f23d3ba6c + last_write_checksum: sha1:d80f52d6e012e26551f2fc6e49ad25dd2a22d423 + pristine_git_object: 77c04173688934e1b024f1401da75240777ab5c5 + docs/models/get-plan-response.md: + id: fd0d6a5893f8 + last_write_checksum: sha1:8e8f4c66cf8c4cc8d6129a0d5719dc6a95d61e79 + pristine_git_object: 570023d52cde6b052ffd014309f4f887c525cb84 + docs/models/get-plan-rollover.md: + id: 8ff9768b18a9 + last_write_checksum: sha1:cdf16a0261b49d6cfbe56cf003d94e9e9f819ea0 + pristine_git_object: 2ed20d9be6b31bd70b2d30f0b517cd4470cf6273 + docs/models/get-plan-tier.md: + id: c466d2316ebd + last_write_checksum: sha1:65962abcb825e75339ea22e000f6b6e7597fa159 + pristine_git_object: 1577a01666d7db242dbc472d2311185c38fb89fa + docs/models/get-plan-to.md: + id: 90434fb9c1da + last_write_checksum: sha1:a6bc90910fbd84449aee946bfe08835049643304 + pristine_git_object: dd7f0b9053cb9e4ad851d1e9b50fb3c9aa13448c + docs/models/get-plan-type.md: + id: 5300ef539ed8 + last_write_checksum: sha1:71adbae5b4d49f8e04676cf58a35318bae15ac48 + pristine_git_object: 75cd05fc9753020eeda5607a4cdefb0723b03482 docs/models/included-usage.md: id: f27abcdfdd7d last_write_checksum: sha1:ca0a41260fa62322a9525f4267ac0ec6d93ae6d8 @@ -720,8 +984,8 @@ trackedFiles: pristine_git_object: 39f3d1c3ab247ec4559923d5191fff971b8e5572 docs/models/item.md: id: 40dd7473ab87 - last_write_checksum: sha1:251fbbc8ab71d857c57318baa8445c5bc2a04a89 - pristine_git_object: ed47413dfd80f05f59b2a5f870b612430faea3f6 + last_write_checksum: sha1:5a9566a4c38c01c126b5024eb5178b00696eec1a + pristine_git_object: c090aed3f7bd612068482258027339e35a59633e docs/models/list-customers-env.md: id: aa422f2f068e last_write_checksum: sha1:2813f4b038dd5a0145a4904890f8e87bc83ae53b @@ -810,26 +1074,106 @@ trackedFiles: id: f90d587b8227 last_write_checksum: sha1:a2a161ab7484bdc88a761c9f1317f3ec45c5fdc6 pristine_git_object: 8561f5a4e0c0ba1a6a51af8a42713d89b9ba40e9 + docs/models/list-plans-billing-method.md: + id: 925f450419aa + last_write_checksum: sha1:f21829d201a1c91e6ca49463665829e541673d1d + pristine_git_object: faaec3e2653fb569cf621ced508c9b9d163f81a5 + docs/models/list-plans-credit-schema.md: + id: 3f2d4bd971cc + last_write_checksum: sha1:11870331e68516a49daa39eab1dc751ee0a8674b + pristine_git_object: 2e6e429f693aa84aaeda77421040f827cdd1949f + docs/models/list-plans-duration-type.md: + id: bc63d2df769a + last_write_checksum: sha1:776412644be4783cd7fa9929c44f47cea49d2c03 + pristine_git_object: 24872dad4da39ca8c862e2629fece4bdfcf036b7 + docs/models/list-plans-env.md: + id: ef9fefbeb4f3 + last_write_checksum: sha1:5ae97a1a4b7cd7b5c28393370fc70b0a3ad0f9a1 + pristine_git_object: b96f9cd95d8b53e7861771dd649b07607ba5f270 + docs/models/list-plans-expiry-duration-type.md: + id: 402de479f254 + last_write_checksum: sha1:44dd4a40c1454a441e2ab569f57dab51dd13f77a + pristine_git_object: 4844fa2eabe6067b1145b9f25cb1a9ba38eeb3d2 + docs/models/list-plans-feature-display.md: + id: d27baf90b440 + last_write_checksum: sha1:883be8ae59b1164c14ff3f905365186ed4fdbc38 + pristine_git_object: e80bf3060e27fbfd2b1aa6400aa83dd8faae98d2 + docs/models/list-plans-feature.md: + id: 2dfe904a0b39 + last_write_checksum: sha1:a28c0ca698ffd23647239ac6c2d7d69479c6d125 + pristine_git_object: 9607cbb75c6299d1f006520a2369adc10f558d4d + docs/models/list-plans-free-trial.md: + id: 3ce407d3abd1 + last_write_checksum: sha1:9e4149edcad2f7da6ad8bb0a16df517f4deb5644 + pristine_git_object: cf68bcfcfe6f64c0ad572bf6b30f5758ed98b4aa docs/models/list-plans-globals.md: id: 0ac8385a612e last_write_checksum: sha1:e98f76c08fe70bd0b28e9e60669b01a53f5bdb8f pristine_git_object: d8d8023b4aaafb7b16cad0c09c42fa9e83ff098a - docs/models/list-plans-request.md: - id: c531b9046911 - last_write_checksum: sha1:54f0b756e00d21c080648d00b6a6ab26cd496937 - pristine_git_object: ed128a61bc8883f36b36ab34be900a31f8ccf37a + docs/models/list-plans-item-display.md: + id: 1ce17b183015 + last_write_checksum: sha1:6c1fb04f6ac246423d7754c1c5c3010ba9a2250d + pristine_git_object: 534ae703c77698677e330b81365b9db16e57ed9e + docs/models/list-plans-item-price.md: + id: 2adf6736dcce + last_write_checksum: sha1:293360fa3507b5cd5cabb2b3f68e8332fb516c00 + pristine_git_object: 1bd6eaf00158f156ae1804a3c7ad5003913b00aa + docs/models/list-plans-item.md: + id: 320df11123d9 + last_write_checksum: sha1:d210059b6169b3d4ae9f1edda037128c36c96683 + pristine_git_object: 378d7d1cba1dbb7be7733b007749bb6d719e26bf + docs/models/list-plans-list.md: + id: d916e8f7c446 + last_write_checksum: sha1:d64dd4d5af521d0ca10ffd555d3b2179e89b7088 + pristine_git_object: 8337193bfef8d503aca6fd1b969b7181bf3410fc + docs/models/list-plans-params.md: + id: 4b66bf1417a6 + last_write_checksum: sha1:ace49e58845a78383d5e26214e791bf7a131fd5b + pristine_git_object: c77558ea7f20e16666bbd628c87ed03cd356529a + docs/models/list-plans-price-display.md: + id: 03e993ba6d32 + last_write_checksum: sha1:671e4bd25c1aee74f3a73b652736fbea4266079e + pristine_git_object: 151bd7cef491657c4abca9d42008db6e3c7f0906 + docs/models/list-plans-price-interval.md: + id: 4fa8aef0b379 + last_write_checksum: sha1:72d2e73954e84b0dd48e4a4af9a618d2cd81ab8f + pristine_git_object: 30ff6e6a966cd85f9754f0cccb2ccaba7b033208 + docs/models/list-plans-price-item-interval.md: + id: d61bea75abb4 + last_write_checksum: sha1:c2fef21a913012ccdc85cda5c744f5118311af5b + pristine_git_object: b6fb74fa26de953985e49d79fd64d7400cf72aee + docs/models/list-plans-price.md: + id: 0ff7fddb4c5c + last_write_checksum: sha1:ac808a57822330e7ae85f89c01baef6f8b71daba + pristine_git_object: 221e8ac6b0ee5624f8a778162a56f0982458262a + docs/models/list-plans-reset-interval.md: + id: a8239738ef9c + last_write_checksum: sha1:6105403c713550f4d3d1c6a785e2fece51fc1454 + pristine_git_object: c6b71b112f78677e6051a95cb8da7b60007fc690 + docs/models/list-plans-reset.md: + id: 73e6ea5c00e7 + last_write_checksum: sha1:21018da5956ea86b823cae081af9a99c1400a8ad + pristine_git_object: 1f6ac37850068cf1dfe4dc7743d0abab5cebb127 docs/models/list-plans-response.md: id: 9441ad31d57f - last_write_checksum: sha1:44fc1035b00d64902c4faba40c680e9ea1537edd - pristine_git_object: 69b048bed027e783e547c8f66e32b5d3857d8f09 - docs/models/on-decrease.md: - id: 101f3c344c1f - last_write_checksum: sha1:b8ddb1671b4362bc1aac1936914e10aa554414e5 - pristine_git_object: 9fa821f88e8a384d7c7341281ed9c4156997e1c7 - docs/models/on-increase.md: - id: 2094ea0eb56b - last_write_checksum: sha1:7659fe425aaa2b88880e746f18b15bdf10b910f3 - pristine_git_object: 93010d453c873028de83eddc22d515539582a209 + last_write_checksum: sha1:bc3ef6b2727337618f63666765f639f53e8572cb + pristine_git_object: 55a7c5e5e99353bdc08a15805106262cf2c6bc4a + docs/models/list-plans-rollover.md: + id: 19aa526beff0 + last_write_checksum: sha1:c80cdda87eeed13f3ed024a4629a1ae752955f12 + pristine_git_object: 760b01c5522a773685658074ba52e25bfbad02f9 + docs/models/list-plans-tier.md: + id: ee46ee372f11 + last_write_checksum: sha1:2fc0d038dd234a0b4200a7afa8992461f633c6f9 + pristine_git_object: 04a868be6df7cfd2461a87f928c606144e623a62 + docs/models/list-plans-to.md: + id: 219811266af2 + last_write_checksum: sha1:ae21918d904d84961771ab388c897c8c92b38d61 + pristine_git_object: e8c79419fa63be74a687c7518f6d9b3b0a8c38b4 + docs/models/list-plans-type.md: + id: 902fdb41bbb2 + last_write_checksum: sha1:8a14d90ad1601b2d21551520d37af9a93fe51db1 + pristine_git_object: 4ea81aa954edc194f40ee68038b0d4f578c04ef8 docs/models/open-customer-portal-globals.md: id: e0e501393359 last_write_checksum: sha1:eb5269be19a6426dfb429110bd750f61a9e2495d @@ -844,60 +1188,64 @@ trackedFiles: pristine_git_object: 160d8340897a8bb4ddc8999bd05e49e2baf3c0ec docs/models/plan-billing-method.md: id: 4789ae90ae01 - last_write_checksum: sha1:8b53127c48cd1e81a29d62093ae96a52359b268a - pristine_git_object: 930e05fe377d4ab12fd2b0245af950d9fd637967 + last_write_checksum: sha1:034ade6e914f7441adf1683c0a9a725bb3ed0234 + pristine_git_object: 6a3e64020748ca7ae31dde83e60228393c659da5 docs/models/plan-credit-schema.md: id: 4a323c1dbf0a last_write_checksum: sha1:167acec310caca3e8e3b1cd5461c5453994f09c9 pristine_git_object: 9dfd58042a96b6de19c6f5f3a21319e1806a35a0 docs/models/plan-duration-type.md: id: 522f79a4e1c8 - last_write_checksum: sha1:6265d10215e91bb4846f1f7648293cf04530d3d2 - pristine_git_object: f555765f6fcc466585e692849440adf29101451d + last_write_checksum: sha1:1e4df37111b655c409a222f584889f794630e9df + pristine_git_object: 5ca43e03701cb24d900c6fd812a5a140be6a1039 docs/models/plan-env.md: id: 2684553fa0b2 - last_write_checksum: sha1:43ecc2f0ae7ad2dd6acdbf3ea9a5c779855ede8a - pristine_git_object: 73febb8eb90f0795e0bbcf16621698de452a1f41 + last_write_checksum: sha1:8dabc92b19ee301cffbe36bd04e57f33fe05b078 + pristine_git_object: c373f26a00337e22d7530eb9dd99c78bd2970b11 docs/models/plan-feature-display.md: id: 4a23e75025f8 last_write_checksum: sha1:bf383e336435e84f0c51cbf12ad34db39fd5e8cd pristine_git_object: 659e383eacdd48be82e3caa9beeddec253f70168 docs/models/plan-feature.md: id: 1f1e65046cf0 - last_write_checksum: sha1:9074682f8d32da2094c50b0da20a9d7b38ef1fdc - pristine_git_object: 1fdccbb593aac6e1317b73dc7fc16f562ca7ac1f + last_write_checksum: sha1:c010291b373a716d33c27e98eef33c5c2b4f380a + pristine_git_object: caf95f50d59cf11fea0aa497ec9709536d68f95d docs/models/plan-item-display.md: id: 1004f58a3986 - last_write_checksum: sha1:922a8816cd34fbb741b7ec1913d173cdf3d57894 - pristine_git_object: decdbe96b1f83815156d96e1212ffbe7228263f6 + last_write_checksum: sha1:be95ae9b1d0f502f6edd2e45179d1b5e47d12c70 + pristine_git_object: 7b445ddbfcb5f1eaa4d64460de684010dbcc026f docs/models/plan-item-price.md: id: 8b84292b413d - last_write_checksum: sha1:95c9dcbe7fcbf5ac8233d3ecd456d1b0c17a20a1 - pristine_git_object: 849a03b444996d07c97add485d0b3d3bc15ebb91 + last_write_checksum: sha1:7900678f68d040f299e43a94771577bc5f905c38 + pristine_git_object: 76428e62a026f32c7462222d3aff3712c3068c63 + docs/models/plan-price-display.md: + id: da4df629d91b + last_write_checksum: sha1:bad027df2d61ccfabac1efb14fb38a05d40bf479 + pristine_git_object: 61d0d0140fdca02b6fb7b1767e44a57789ff970e docs/models/plan-price-interval.md: id: f4940ecda555 - last_write_checksum: sha1:281dd412e9ce4701b693c4661419f16c24b1bbb2 - pristine_git_object: cf74878b078969a4d39e10ef9d60a655c8264e16 + last_write_checksum: sha1:74cc6484180203f73664a7b151f5b49fb56b9072 + pristine_git_object: ce8ac898fd976c7e213cbfa7a95ec0e25b5cf761 docs/models/plan-price-item-interval.md: id: 2c196a6cec70 - last_write_checksum: sha1:0af5bcfee0b8c6561dd1b1f97877a7d37eee781c - pristine_git_object: 8a29c3ec3eb89f59b4c3388bdd7d3330ee96e0fd + last_write_checksum: sha1:6eb92ba0d4c53b5c2942552ad33c4c8a585a51eb + pristine_git_object: 630586b26f677b90d85d37ff688c8ac8d3b65775 docs/models/plan-price.md: id: f24c0778a8d1 - last_write_checksum: sha1:668a1fea2ab78716c321aeec760f11097553a37e - pristine_git_object: 99883968d894730af81670cab3b5860bb43260cc + last_write_checksum: sha1:0ae6e5e8e0293c24c92e93d0b98462627958bbbc + pristine_git_object: 6a5f8089f942a4a783d148d7a1635970810bda73 docs/models/plan-reset-interval.md: id: 3ae21ed47961 - last_write_checksum: sha1:957ef7145ffd6a231785068b66c82109dade812e - pristine_git_object: cdfc9bb8b6496a41e32e2f08946a40efc09cd5e0 + last_write_checksum: sha1:3707cc1f199c2c5138f1575d9d2d451648083761 + pristine_git_object: 5b8b97ba7166041db705ba0b92320fc2edafd78d docs/models/plan-reset.md: id: 1984f6727dbd - last_write_checksum: sha1:7a5baef11b9fa02a6836b3e20ea3420c5e897489 - pristine_git_object: 867574292d4bcd4890527e80c6bff120290a0ca2 + last_write_checksum: sha1:20b04531084a0f459a1e1f32759dc647571cdb17 + pristine_git_object: 18a09bdae498c5251b912a8698e2115a9ee227e5 docs/models/plan-rollover.md: id: 4705027a8146 - last_write_checksum: sha1:0dd0f870246bcdbfc94af9c23bd39af7c1a10700 - pristine_git_object: 42ba84e2e04724b22c1e07f7284a2a5881079041 + last_write_checksum: sha1:8daa5d492f314a152924cf77cbd5abfba2cfdf51 + pristine_git_object: ce6551a619ecf231881a602e7eff3f19a0df7d76 docs/models/plan-tier.md: id: dd7f4ee452da last_write_checksum: sha1:6c9c35eb92c09460deb94e964a11bcdb57b0d333 @@ -912,16 +1260,16 @@ trackedFiles: pristine_git_object: e573a1e61915a219fc68d1e31dd55c795dda4253 docs/models/plan.md: id: 900c4149ef4b - last_write_checksum: sha1:08f56cb8cac6d89aba2436975994c1648d8d286d - pristine_git_object: c02b9a57fbf832794d06b60296903c7304bddb55 + last_write_checksum: sha1:f5a64f4f525de38300eba5658097d087ac084574 + pristine_git_object: 4b2e0aaf440368a1d29a1a1a87149a162733b914 docs/models/preview-attach-billing-behavior.md: id: d74cdf2445f9 last_write_checksum: sha1:dc93f1c2f72a5edc0632962b47e7642c1b206992 pristine_git_object: 52a5ee918a72ccbb8b0c022d1b7e629526f7ba87 docs/models/preview-attach-billing-method.md: id: ed9b4632aabc - last_write_checksum: sha1:3336a7e408425ec5e3111a00a19bd1563e13e7bc - pristine_git_object: 7d5384ae1d24f2ed2f9cfbbd59b53c198bfaa27f + last_write_checksum: sha1:eb5a3f7f8f5ad0474de57572cfe430997d4d7d0e + pristine_git_object: 2994990f3374717142b5cce7d684d9351c35b38d docs/models/preview-attach-customize.md: id: 56b1da317d34 last_write_checksum: sha1:327d93e3658bf85c3a0605a25213a68f5773cff1 @@ -944,20 +1292,20 @@ trackedFiles: pristine_git_object: 7d77c8d2cab05bdc384ba2faff5034d32928739c docs/models/preview-attach-duration-type.md: id: e74685b36193 - last_write_checksum: sha1:5b256f824629ae65cc8c6e515d63c12a4f5fc6b4 - pristine_git_object: c42259efca376f8f8807fbaba355eba1627ad975 + last_write_checksum: sha1:a63ff71ade48191f56dc709a4aec8d55f812a50d + pristine_git_object: ce4bbb87886554caca7bf07a0a6964f8d6b89966 docs/models/preview-attach-expiry-duration-type.md: id: e306a966ba64 - last_write_checksum: sha1:becf749264efdbdbd1e725deae55e11534cd2a2a - pristine_git_object: 9cfd61ebc94ce21266b36407d4544992eafafc2c + last_write_checksum: sha1:13ef806fe9391ef197689f9810d4104152fbc8ad + pristine_git_object: 7c9a122f8bedfcc9c3d8bc3131b61d8748efe1e2 docs/models/preview-attach-feature-quantity.md: id: c448b13170d7 last_write_checksum: sha1:1f37b34f37160e82dadf752cfcc0ebb18c593645 pristine_git_object: 8037d8cf7d96f480e95f25679d386eee7c18a20a docs/models/preview-attach-free-trial.md: id: b82fa3a54db2 - last_write_checksum: sha1:f9108e18b8f4ac3b14cd0e9414879283b65da1c3 - pristine_git_object: b65e3dcb31c32f14baeae021000610dc9e45ff93 + last_write_checksum: sha1:062f80f98d8c0e33722c8855bae1d4a138b604f8 + pristine_git_object: 955420850b6b619e71fc4f6c1f20a58e502f7644 docs/models/preview-attach-globals.md: id: 6f9378538e25 last_write_checksum: sha1:468f1060b7560bb8ef29eaa6b142852d9a2906aa @@ -968,16 +1316,16 @@ trackedFiles: pristine_git_object: 97e52602f6ae11592f38d3949f781e685554d67c docs/models/preview-attach-item-price-interval.md: id: 9d980cd59b4e - last_write_checksum: sha1:ea0ee01ba5fd8db2b90a2448db52c805d91bfad3 - pristine_git_object: 26c8b425de1cdf7f141cfc5368aea98e82143351 + last_write_checksum: sha1:59a90e1b6553a33b40fe4643bbefa7e2e44d6862 + pristine_git_object: 4d66328a896d1d902027f2afb31f643980df8a75 docs/models/preview-attach-item-price.md: id: 7198a3dcdecf - last_write_checksum: sha1:546227317a65ddef8f69ecdc53829da946471fb7 - pristine_git_object: 204288b951204b68d7d3a7e74dd485e87c151c42 + last_write_checksum: sha1:1baae7f3abf4dcb1d87d4d1100937d87b740b9ad + pristine_git_object: e73f9fdac09fefbd8a8539c8b1b10a1af6499341 docs/models/preview-attach-item.md: id: 0cb27cc26622 - last_write_checksum: sha1:248ae819bd4ad71951acbfe5ce2aac929881ea11 - pristine_git_object: 58d3071e96888c644f5228a58d5a8fc35af9abe2 + last_write_checksum: sha1:3c1bce0e990dc5e9791bbf1a6976231a5e331ad5 + pristine_git_object: 73dbafc8b02fe9e7224efb07d63131f85b334a3d docs/models/preview-attach-line-item.md: id: de7befb3b1f6 last_write_checksum: sha1:45f99e10f5461975bfc3cdadc6f8dcf2599336ad @@ -988,12 +1336,12 @@ trackedFiles: pristine_git_object: 224836d3a6bac1091fcc2c628e4bc43662ce1f2d docs/models/preview-attach-on-decrease.md: id: a2d8483a2bcb - last_write_checksum: sha1:cb620b14004c7e90c91cbeee3605b1b9204c39c5 - pristine_git_object: 7990abab7ca12e1295b486962af7af858139889c + last_write_checksum: sha1:aa579f14f070c3fa958d7d037dbac158cea81ca0 + pristine_git_object: c9d69889a365e6cb13ddcf783b0c58bd83fe52d2 docs/models/preview-attach-on-increase.md: id: e43a332a8b23 - last_write_checksum: sha1:bcfac345638c698108861cf2d2f28754b04572de - pristine_git_object: f12893d76e50a76c0f9d436a5de3a9e5dd4ba2ed + last_write_checksum: sha1:e7c0c226fe50d6b4e99a7cee5fc4cb9b1f0e931c + pristine_git_object: cc361cec667bc3532bc64a7ee9ce21b3ca889f9c docs/models/preview-attach-params.md: id: 29fbf5be911d last_write_checksum: sha1:64aa093712d99c804d86f670cd9c438fa066cde4 @@ -1004,32 +1352,32 @@ trackedFiles: pristine_git_object: f805bd91506382bfd158be4112c48e11f3822add docs/models/preview-attach-price-interval.md: id: b7acb2b27e53 - last_write_checksum: sha1:b8402c8374cf2f522ecf8a3c2b96df9f6d06c225 - pristine_git_object: ec12dc9c248020bc203cebd4e67ffde0c688076b + last_write_checksum: sha1:479c76fbaa4ccac268b016f78d9c60ba4e6c09e7 + pristine_git_object: 58e279131be4b1c368223d8695131de75d84caff docs/models/preview-attach-price.md: id: 73d456b81f1d - last_write_checksum: sha1:723b45a259a1157accf3fc65708957df1867d2a6 - pristine_git_object: fd9c1477143f17c836cf46e26cc16ffab2e4cd05 + last_write_checksum: sha1:f9756d7862af1320b61f946b664a0a0627c43e02 + pristine_git_object: 300a02234207c0a55ef637efc0008d6a0a53ff4d docs/models/preview-attach-proration.md: id: 5396ba36c83b - last_write_checksum: sha1:fc91f8f943a6736493e60ea5d0e61a37a17fadec - pristine_git_object: 0a47b28d0f565652a94da0d99503834d60e4a9b0 + last_write_checksum: sha1:4d9d22da0583e026ee297ca3245240f9f0397dd7 + pristine_git_object: 8492b2b373d252fd79239d3b222c6ab2f6ea126a docs/models/preview-attach-reset-interval.md: id: 47af8773c6da - last_write_checksum: sha1:6ba5df48785895d4469f546f95f2b67624959820 - pristine_git_object: 45a0f9186c182e66df0445ca14ad2664fc3178a7 + last_write_checksum: sha1:fcea540866ac6593776eeaa9fcea0896784e0a17 + pristine_git_object: bf6fb2360afd05468ca95287e613a7095ab413a0 docs/models/preview-attach-reset.md: id: 4542e232812f - last_write_checksum: sha1:432ce97de353b797516b220b0bf8a588946e169c - pristine_git_object: 25dcc11c8522d25caa04fcc8678d8cab9429d21d + last_write_checksum: sha1:c6d831d3e68e5c13780d8e8ed331293e2cb914e4 + pristine_git_object: 38738348cb8b3cb3f1466f4628e7c049ac8bc0a9 docs/models/preview-attach-response.md: id: f53481e3c4e9 last_write_checksum: sha1:2b8c6281969e84f9dd72128f14947d771010b432 pristine_git_object: ee09a52b4875b7fa7f782705cafd17b310d9d20c docs/models/preview-attach-rollover.md: id: 45bd31144856 - last_write_checksum: sha1:72fd8383f04acc9f683c8f62432b790c6da7de52 - pristine_git_object: 61746c7f9f6b45c0d29f9d092ed63254b5f7ae09 + last_write_checksum: sha1:3a2f09b2565a522e050a728c885e822640ba0793 + pristine_git_object: 5c6b64e3be3f8032b12ac36edae7a98e4e1d9838 docs/models/preview-attach-tier.md: id: b673bbf7eb00 last_write_checksum: sha1:87d34d121aa0319c6531a83054cd638e74a22f71 @@ -1044,8 +1392,8 @@ trackedFiles: pristine_git_object: d576dca35cbb63a9111bbc9f933cccfed4f299e0 docs/models/preview-update-billing-method.md: id: 51dabedde884 - last_write_checksum: sha1:2d0a809d249809fd69a88d898a448f11bf68dfd9 - pristine_git_object: 7e312adfb74d1cff7feb8b9cd38f500492625b2f + last_write_checksum: sha1:2c62ff19bad8a6a43708790251fd93d5363031c6 + pristine_git_object: 78837cab496305d6cf168f679081af2b18b34530 docs/models/preview-update-cancel-action.md: id: a8b52c5ce0d3 last_write_checksum: sha1:75917bffb982a440cc34393c99252d563f7fb10c @@ -1060,20 +1408,20 @@ trackedFiles: pristine_git_object: 1e135288641d484a59be68f6cee54df7b9e4d2e6 docs/models/preview-update-duration-type.md: id: 7af46b0f762b - last_write_checksum: sha1:dd203bbfb53ea196dab34a248cca356f549502b5 - pristine_git_object: 8e7a60015cc707a93d88cdeb1f803c02cef32576 + last_write_checksum: sha1:6dbada3e8e294d3738b5ec59f15b78a0566a6bd9 + pristine_git_object: 5e1dafc293bce7150e4f1fa6d1cc96c834b29708 docs/models/preview-update-expiry-duration-type.md: id: 6ab8a72fab97 - last_write_checksum: sha1:897b1f5bd1a186e89ba9681aa2639ab198bf1f40 - pristine_git_object: 1f2e38a003c637c8b00fb7868fea0cfaf96b80a9 + last_write_checksum: sha1:130e9ee8d15957ff04d437eb843954e83a2b947c + pristine_git_object: afde0074e94b32031fef49ea6e5d1755af77498c docs/models/preview-update-feature-quantity.md: id: 11f11ab645b6 last_write_checksum: sha1:ad7c9f3f9c1ffb8016d7433afa38853a04c93c7a pristine_git_object: 214107e1b2a10d78f202a3986f250243f3ef1b3c docs/models/preview-update-free-trial.md: id: 8e0901a527d2 - last_write_checksum: sha1:e2126cb35ad2795a13eafde86639d5dad3a32d33 - pristine_git_object: c17094121ec140d1b4043473a0e8755c23fcdea4 + last_write_checksum: sha1:7e6d93f30e6e2d8115d09ee9c706d259c6456bed + pristine_git_object: a26676fe2c42e7b6778c38c237ee8ed38b4f0b93 docs/models/preview-update-globals.md: id: 7007e72c8bad last_write_checksum: sha1:8b76fc009fcb2884695294ac0dbe6765efaea760 @@ -1084,16 +1432,16 @@ trackedFiles: pristine_git_object: 2cec59e4e1670db77a61e68ec7b243c8fcf66ae2 docs/models/preview-update-item-price-interval.md: id: 3b265ec431b0 - last_write_checksum: sha1:583594e0dfecbb579906ebd140b62d92f23b6403 - pristine_git_object: 331bff6f573798e54fd1acba1e0685005d2b1155 + last_write_checksum: sha1:cfc0e419f49a3da116a12e096bfe4935231723ef + pristine_git_object: bd687b1b92155b4422db03a4194b600d96c99c74 docs/models/preview-update-item-price.md: id: 00b74df0e261 - last_write_checksum: sha1:06f773afc3307d77c99e4952449335d5fa939f01 - pristine_git_object: 220c9e3735e8d685beaf980b9913438271e61c64 + last_write_checksum: sha1:3340ca53318dc1ec09360fcd325f2ec1a805a652 + pristine_git_object: d200a21d5aed93e6a8c0a5a379b294116e0bae0c docs/models/preview-update-item.md: id: 6680b6d5d841 - last_write_checksum: sha1:d966c496e69e86ba57f971e6cad4fdab4a66a604 - pristine_git_object: 6f29adac3fa1418417cafae0db6b487b1e5e7327 + last_write_checksum: sha1:2e6f608a67b071d7bba1168354c4ce648a2362c2 + pristine_git_object: 0b07e45671ed889566400b3213e4b04c806581bc docs/models/preview-update-line-item.md: id: 3b5e9cbaebed last_write_checksum: sha1:3d40288e0414b99512fad8f44dc03205debe0d60 @@ -1104,44 +1452,44 @@ trackedFiles: pristine_git_object: b1733620aabde628d99febde73c5d8a32f2ee2c5 docs/models/preview-update-on-decrease.md: id: e5d78a7b0bd1 - last_write_checksum: sha1:3fd01b49372727991923acb8808ac3ff1607507b - pristine_git_object: 9015efdb69ac5e83713f69f3c0eb32417e5ffd02 + last_write_checksum: sha1:687bcfa927d45856a707099fc4ba4078530a50b9 + pristine_git_object: 8205cb0a13b584448771190dac1256d076339e43 docs/models/preview-update-on-increase.md: id: 9b0255c20331 - last_write_checksum: sha1:288311401746adaa41b0dfb4f5f17b63eded877e - pristine_git_object: 2d0494cfbbaf6c7412c2082ef8f467b55d5b8d57 + last_write_checksum: sha1:07a074f337e4d26a812687ef15d84b7181e8ec37 + pristine_git_object: e6d6115ffb33897d7bdde1c7daaa39efdbbd9598 docs/models/preview-update-params.md: id: 4f27fa514996 last_write_checksum: sha1:6cfa299847d728e46c8fee92eed09c5a43aeea4f pristine_git_object: 8f98d98b0c6783b02252457c24704dc9d1b31db3 docs/models/preview-update-price-interval.md: id: b53e2aab5336 - last_write_checksum: sha1:ace2f2252fb77f68443eacae090d6e0b6cdc5018 - pristine_git_object: b1a5ecd50b6622c28a9925bdeffc4b64ee497ba9 + last_write_checksum: sha1:17e179f4dd4983f53ac679abff7a43f87a9767bb + pristine_git_object: 7f8dcbca5b0000c9f63dc6218159983c72f14fd3 docs/models/preview-update-price.md: id: f1d2ea5fd71c - last_write_checksum: sha1:9c6ac2124188862c054902f0b5bab4d4a0649148 - pristine_git_object: 2b270cb8648863b0222549e5dd839038865227fc + last_write_checksum: sha1:3751ec600ef1e5395f570c3b64fd1c4353e0d23d + pristine_git_object: d99d1de9438b6a843da64847fe9add244a7ee94c docs/models/preview-update-proration.md: id: 096020425f5f - last_write_checksum: sha1:809d8b0423478847de40e50635159cfd0525206d - pristine_git_object: a71c9503b0802dcdeb0a7219c22929ac952d8521 + last_write_checksum: sha1:2407ee797ec36dc229115a98eb9470cee8597854 + pristine_git_object: 050ae04104ddf95dfa6d802d9caa132db36ed821 docs/models/preview-update-reset-interval.md: id: fbd38c74980b - last_write_checksum: sha1:9d37db272f92e28704543375db72d2daab26571e - pristine_git_object: a95452f3272a6c9142c5964237d821b6f17d6ebc + last_write_checksum: sha1:86d438e78ab08234f1416837bd356e5c240bc6b2 + pristine_git_object: 0aa02965f7702c2fa29ec584c9a42fcf2b77bc6b docs/models/preview-update-reset.md: id: e2d2c2dc2f09 - last_write_checksum: sha1:0af1489cce57d31d9a4bc4ffbbfa3fb3216c2e54 - pristine_git_object: 0c1660a205b76c69293acb1a82f61a0e5e012d2b + last_write_checksum: sha1:5b5e5385346918e0f08526256ff1add39aa6d894 + pristine_git_object: 0765a516dacc6291b302c98a17bd62753c075619 docs/models/preview-update-response.md: id: 8106134ab3a8 last_write_checksum: sha1:d361a7748d176bab0a46ccd0c123db00089d66bf pristine_git_object: fd461344e5ec770652f75ecf8bc5751545f769a3 docs/models/preview-update-rollover.md: id: fd27620d33af - last_write_checksum: sha1:2db61c95557031769fc1ec808711409ca0a827cc - pristine_git_object: c9e3aa1977dfc45030c0bc82bc476387178a6b97 + last_write_checksum: sha1:c02354fc996937d2d71acbf4c6938a20089ce1f1 + pristine_git_object: 73f74a0da389040838507916ffc4cce5b41caa9a docs/models/preview-update-tier.md: id: 75b24899101d last_write_checksum: sha1:043d1828e1666d7a17607c2fc9c09801408c978f @@ -1152,12 +1500,8 @@ trackedFiles: pristine_git_object: fcda14627b67ed67632122647d46e2017e2d9406 docs/models/preview.md: id: ca71b601ef12 - last_write_checksum: sha1:83b97643b438c9f8c649d8d15d7e8a20ef9eec96 - pristine_git_object: d38bd912d9225d833d01e2a9e0221a79ea19f0f6 - docs/models/price-display.md: - id: e7cc8364bc4b - last_write_checksum: sha1:f7d122e7b7776cdcffbc40fd2ced81a215d89c23 - pristine_git_object: 9fd5718215ab2855e209fdd606611f33fbf42562 + last_write_checksum: sha1:aa806d7dd8515ee48400ccbae3f07b86b9694420 + pristine_git_object: d8d0ac14ea6dafffa2f62eccb094cca9f153c4bf docs/models/product-scenario.md: id: 53b34e452304 last_write_checksum: sha1:1b89a6c5aca71e11bc1c602eb29f5d7a5d62cdd8 @@ -1166,10 +1510,6 @@ trackedFiles: id: c91436bbe13a last_write_checksum: sha1:4f32659bdbdd6cc02f2e3664709c4ff969def976 pristine_git_object: 6d1ae6a8f5f9b91e51d1b7f36b521c1ba49c2856 - docs/models/proration.md: - id: ac1d089c0fd1 - last_write_checksum: sha1:a0763bf3863245e1ea7004d99849431c154e9ee6 - pristine_git_object: 05c6c5284e3e954c03ab875fb305da54e325b60a docs/models/purchase.md: id: f872769b6939 last_write_checksum: sha1:f478ae26fe728efde7d8e38ce46593dab6d5f9d0 @@ -1208,12 +1548,24 @@ trackedFiles: pristine_git_object: 4f9293c3e3617e496703fb7dc28a6947b8b03ff0 docs/models/scenario.md: id: e3aad8ab5efa - last_write_checksum: sha1:5d6f7c24e821bf73b9ea5f4915448acc27c0f84f - pristine_git_object: bb56d26cd38f06b01472ddde44f344707f2952c4 + last_write_checksum: sha1:dea955e2e6537c03af820669075ace61a6d283be + pristine_git_object: 9d59212541bcf67d5332b474aaa48085a4be19a5 docs/models/security.md: id: 452e4d4eb67a last_write_checksum: sha1:d2af82412a97b139d12d416d11a235638001243b pristine_git_object: 314e31deee282b89d14d2a2ef710ee795c9a936c + docs/models/setup-payment-globals.md: + id: 10b1bea5c60d + last_write_checksum: sha1:bed0598b5ae5518236246d63749795cc6eaab50d + pristine_git_object: 6e60d36b1bcaa5302444c8135670a8d24e2efc24 + docs/models/setup-payment-params.md: + id: 24c3d70301e8 + last_write_checksum: sha1:da6ad4cc65052521c59b17142eb1553792cda544 + pristine_git_object: cb913dbf5e49c2d45cf7ed53f52f068b14826796 + docs/models/setup-payment-response.md: + id: 9706acdb1f5d + last_write_checksum: sha1:e7fe8e1eaec81968a37dad8caaff5bf68d19e6bc + pristine_git_object: ecb9949b8f984a662874e0bb84cb4b467ed90abb docs/models/status.md: id: 959cd204aadf last_write_checksum: sha1:08c58905f6c77c4ff486465c91970c69178eaded @@ -1330,6 +1682,170 @@ trackedFiles: id: 55ef8f61ed28 last_write_checksum: sha1:8edc60f47c6feaabb96b01479306ce762c3b863c pristine_git_object: e537c89a174c185a0833eb63be1e07d8a0558325 + docs/models/update-plan-billing-method-request.md: + id: af48a5d0fc97 + last_write_checksum: sha1:824ca7edd0df4cee44e27224395b504f970e0b1f + pristine_git_object: 3fcfc1ffd0e051ca7d6267202af8ac6756a48f0e + docs/models/update-plan-billing-method-response.md: + id: ddca1b594754 + last_write_checksum: sha1:045532224fb1a560ae04aa85cfbc175a5208ca9e + pristine_git_object: 1c3d7ae7c5e8f54333c14c3e480eefdd7b4b1ebf + docs/models/update-plan-credit-schema.md: + id: acaf39d42386 + last_write_checksum: sha1:af3af2720a587f377efbf14df3e586cc376ead26 + pristine_git_object: c73b5150f3f0e1aaa0979420dbe2f370786bb626 + docs/models/update-plan-duration-type-request.md: + id: 52dbe07c25eb + last_write_checksum: sha1:86b76dc24ebc1bf76e7d791b0b925dd772ec1d3f + pristine_git_object: 823ca3a08fbfe410bcc170abba6a9fb1a26aa848 + docs/models/update-plan-duration-type-response.md: + id: 7e8e1a2d27c1 + last_write_checksum: sha1:ed21c15df2b5c41affc78e28440b4e3051f7e0a2 + pristine_git_object: 1a60b6ee9910560a58e9dc1ee2413465b6f0b724 + docs/models/update-plan-env.md: + id: 1ec7258b0baa + last_write_checksum: sha1:5c914a9bfde14e77725e1f7fd80b55c4435ba9b9 + pristine_git_object: 3027bd5dd67aadcabafbd0ebcb694f654fa9a143 + docs/models/update-plan-expiry-duration-type-request.md: + id: 9deda139c872 + last_write_checksum: sha1:ed51270204f6b3b01d4d4f4fc2069debfdddec88 + pristine_git_object: 89747b93d89370fa39a0b3a802c255401ab17567 + docs/models/update-plan-expiry-duration-type-response.md: + id: 4f1456745f6b + last_write_checksum: sha1:037ea11512c88eab6c9db6733344a4a99edbb3ff + pristine_git_object: d886a3142cb7db7666f94de89ad811a3be1a66fa + docs/models/update-plan-feature-display.md: + id: 60e529fe4eec + last_write_checksum: sha1:bcb11546dcfc1e87c3b7e2c99e158441a6da6ac7 + pristine_git_object: 12a3fcf7180f9f90ccc28d7312b192fdc7fa18a2 + docs/models/update-plan-feature.md: + id: d12b26ef19a6 + last_write_checksum: sha1:37399e6b4f6b83cbdafac8ae03d63c079eefd5ea + pristine_git_object: 842a819efcccefb73ebfd1e41308442d0c45664f + docs/models/update-plan-free-trial-request.md: + id: d21d1bfe47f1 + last_write_checksum: sha1:837b78b4d02ea719910a3d26d8e621153c2f490e + pristine_git_object: cf2693ca30155c13c1206fd8b21beab0c6c60814 + docs/models/update-plan-free-trial-response.md: + id: 40d7a58d4a1b + last_write_checksum: sha1:2128e84042823fd2afff2607638315697ec178f9 + pristine_git_object: 74e60b419e470fc57858f9f7f3d061cbe9392aa3 + docs/models/update-plan-globals.md: + id: 7d10db3da7f4 + last_write_checksum: sha1:1f3b4a381c21ec5d5654451447b50f420e1f1447 + pristine_git_object: 525772be37dad1f38073e97f1be62c6981cbf4ab + docs/models/update-plan-item-display.md: + id: 232cec417ab8 + last_write_checksum: sha1:19f639764a0cc88104d8940cd8cdc679fe192f3b + pristine_git_object: 11bcb3d4216ae8298ca8d423394eb4b9a86b4c0b + docs/models/update-plan-item-price-interval-request.md: + id: dc5f73e10be9 + last_write_checksum: sha1:ae35c3a73408b753de158ac14acb55f7b37f5b74 + pristine_git_object: 47c968da029557c2c8c0e37a6492c281aae4fefd + docs/models/update-plan-item-price-request.md: + id: 07a9adc73ee0 + last_write_checksum: sha1:e89b1011d1e3618e18473dbdab578c419316533a + pristine_git_object: e55afd7dc811297f6f31abd25d12fe3214e1c469 + docs/models/update-plan-item-price-response.md: + id: ae8fef4236c2 + last_write_checksum: sha1:3ef8bd1627be10a987355572fd54bebaeafdc509 + pristine_git_object: 4537543a8e1df2eb639904b00cd52c9e699ffc03 + docs/models/update-plan-item-request.md: + id: 0f16122add7d + last_write_checksum: sha1:37b47e2e12152945dd93fc253ba5768f85320d43 + pristine_git_object: 0d555ff5031c31e1de3e2a4a04bd605d1c40bdf8 + docs/models/update-plan-item-response.md: + id: 091df7116a8d + last_write_checksum: sha1:5e9fb49b7d074d803c81bbb3911d842692502441 + pristine_git_object: e70bd094e699ddd3c47cfd38d3c4d996a67e3373 + docs/models/update-plan-on-decrease.md: + id: 77f89389fbdb + last_write_checksum: sha1:4800344dc11db94a65561730e88bdf0c636f04a7 + pristine_git_object: 7ef6c9c0cb1d794d0cf17895736f61c3f9aacdf7 + docs/models/update-plan-on-increase.md: + id: f8aa8ad5ba15 + last_write_checksum: sha1:0b8c6c9dba416147a6808ea603e8dd4d07312094 + pristine_git_object: 585c71d0660618338988c819b2c60b5ee4ea29c9 + docs/models/update-plan-params.md: + id: baf87a97d876 + last_write_checksum: sha1:53643ad4e9285dc2dccbc87927504103f27e5644 + pristine_git_object: 39fbd32bdb1d71776f82cd00ea2fbe08c9fc82ce + docs/models/update-plan-price-display.md: + id: 76872726ec8f + last_write_checksum: sha1:79202a6ddbaa7c0907cba3ecba2c906d14351ebe + pristine_git_object: 13b237d44534236344dba4fa2eebf79fdd1e623d + docs/models/update-plan-price-interval-request.md: + id: 4ed26e8ca8de + last_write_checksum: sha1:d2339141b19e242915a2ca1cdff0a390a726eb31 + pristine_git_object: 308fdd7c25468a6dd81b07ed46391d1a9bdc0113 + docs/models/update-plan-price-interval-response.md: + id: 895a33399c7b + last_write_checksum: sha1:bc84d3d69ff743ef119f7752e6256f3aa01c5cb4 + pristine_git_object: 1bbe591e12e17abd1e6d439f725515c2ad30d4b9 + docs/models/update-plan-price-item-interval-response.md: + id: e909a35141c8 + last_write_checksum: sha1:cb7187b76af4aaebc38bef1bddef721ca8ec85f8 + pristine_git_object: e3ffa074588d8dc4cc5ce76cbb57b0adcb537228 + docs/models/update-plan-price-request.md: + id: 4602b3ebb686 + last_write_checksum: sha1:d2478e13e54ebbeedc86d2d95585804da159859a + pristine_git_object: dfeacaa9409b18278e94d55445e68cc06a9fa5e7 + docs/models/update-plan-price-response.md: + id: 60c497fb4b67 + last_write_checksum: sha1:15832c93a4476d978d026c896e7d18cb8a418540 + pristine_git_object: 8ab1199656ce022978083d2152660e45016e2ad3 + docs/models/update-plan-proration.md: + id: 99b900631e5e + last_write_checksum: sha1:c1a67717271adb3a438aee61c9f69905ae0c386b + pristine_git_object: cffd373fd23ac17c837c3c68f6e152a0fae5982f + docs/models/update-plan-reset-interval-request.md: + id: 1478e7edd296 + last_write_checksum: sha1:b5564bcc3c60065f8064a3a648df8959fbefe9d2 + pristine_git_object: d30dc71cbb6362b2817893a7b9d85f600b3fe704 + docs/models/update-plan-reset-interval-response.md: + id: e04031025a69 + last_write_checksum: sha1:39f5bdcb899e1855e84edef3ce03c619a7ef8b40 + pristine_git_object: d89b60eb37801f8fa2a3f4653e65c0ef3d356d13 + docs/models/update-plan-reset-request.md: + id: cc5ffaf44e69 + last_write_checksum: sha1:7b5494303638691323b06a24345154f1922c09ae + pristine_git_object: 6ee22252809b0da65c14987393062e398e2c44fd + docs/models/update-plan-reset-response.md: + id: f8864349bc3e + last_write_checksum: sha1:80593a5152adeecc45e139e0ff2daefca75b5b7c + pristine_git_object: a91ea7b581af0524ec0a17e2d4dfecca576a5d68 + docs/models/update-plan-response.md: + id: 438137d6d905 + last_write_checksum: sha1:678fa9ec908bca8fd7402589365d26c8cce9692b + pristine_git_object: 3e4f687bd0e2ce7869031aeeeef5fac9e441e6a6 + docs/models/update-plan-rollover-request.md: + id: 70f500c0dfa8 + last_write_checksum: sha1:c026dc1f10f556c1d984a92877814d06e27310b3 + pristine_git_object: 27f4879d728811e8c9fdfd6016ad47a8b2107996 + docs/models/update-plan-rollover-response.md: + id: d6683f4aae90 + last_write_checksum: sha1:faa50304cb842ec3882fa8061fa676f154b0a0c4 + pristine_git_object: 8bad9b30e3d3445904a7deab4bd769f28a412f44 + docs/models/update-plan-tier-request.md: + id: 0067947645f7 + last_write_checksum: sha1:f20bf92011ad03bb498a51a50d06e42f73e71f97 + pristine_git_object: 25ee574958787d4d04403d94502e378ea07b27d4 + docs/models/update-plan-tier-response.md: + id: 47780329e7b3 + last_write_checksum: sha1:9fe9a5111627a422617ae1ce7393b5b1909c8dc9 + pristine_git_object: fd4d5aba2e130f732d8babf75e80c7879e8f63e3 + docs/models/update-plan-to-request.md: + id: 74b5afa0a080 + last_write_checksum: sha1:1ce7ca75b7e8711d0bd8a10eb207d2d1252949fd + pristine_git_object: 19de0d751df0dd609d430e89ed9e30f50a0b35c6 + docs/models/update-plan-to-response.md: + id: d59b72ee8c42 + last_write_checksum: sha1:51dc9fc0e64eade8ed9c9082b9b1916dae72f750 + pristine_git_object: 95d1c8e8cb7c7ade9ce1970e92c1cc899e1e3df4 + docs/models/update-plan-type.md: + id: 5cfd33c31fa4 + last_write_checksum: sha1:dbe46f3341404b4f4da84312247a83a410f26129 + pristine_git_object: 286ef6a9dc6cf9cb52cedb2b6ffb75be463d1d81 docs/models/update-subscription-params.md: id: 2f1abbd42a8a last_write_checksum: sha1:ebdf31405ff59b8d706482e12ec56fb35df86614 @@ -1348,8 +1864,8 @@ trackedFiles: pristine_git_object: fb242dffad941fbf1279dd86b439d776792395ed docs/sdks/billing/README.md: id: dc915331dd9d - last_write_checksum: sha1:991fce17f7f65eb7cd06eadd1fdd40b853f14660 - pristine_git_object: 3f8ef93aba67358061c285ccd346e8954536d04d + last_write_checksum: sha1:7735e7f37d1aacb270c9ecd06b74a4d353c80584 + pristine_git_object: c1331f5a3f08cbc1fbccc88f0c75f53c251fe1db docs/sdks/customers/README.md: id: 9332759cffc2 last_write_checksum: sha1:67ee9f4c5ba6f23fd7e16807f8503ed5a065e1ba @@ -1368,8 +1884,8 @@ trackedFiles: pristine_git_object: 77e37f0406950d09254f576d603ac93d98ffcd6a docs/sdks/plans/README.md: id: 2d8c741fff57 - last_write_checksum: sha1:291981039b36d8a136575a3086801bfbb65bf29e - pristine_git_object: 1be0bf7ad53aa2d5d54d5a4b9d98484596e7b971 + last_write_checksum: sha1:004893ab53317f43f2f9a4d94ab7b41bb60cb76c + pristine_git_object: 0d6bc90b41e2601a6dc3b3bd87fd49a9b89eee9a docs/sdks/referrals/README.md: id: 50b71f597f20 last_write_checksum: sha1:a9ad9263bdca225c9730d00239a045590ba49e56 @@ -1396,12 +1912,12 @@ trackedFiles: pristine_git_object: 900d545ed58929951e2208e1bec791cb264429a4 jsr.json: id: 7f6ab7767282 - last_write_checksum: sha1:1c0f0199845b5a637b883ddd6f8df7e7421ab218 - pristine_git_object: 2955bcaf50d7d33b4bdf690df6443a758d58c41b + last_write_checksum: sha1:b8fbee7b8701740466a06f155d40c1314751c7f3 + pristine_git_object: 13504f125f055138b67addee717e17e646990d99 package.json: id: 7030d0b2f71b - last_write_checksum: sha1:4b2f067c31cc641699beb56e7b06c62bb65a3c0d - pristine_git_object: 14e98075eceeb7fc3852109afb3f3083db3a112f + last_write_checksum: sha1:b43309bf91d42f1b90c58c6a6d99e88ae32cf29b + pristine_git_object: 483f45638e291af37c19cdcead31dfcd5733a229 src/core.ts: id: f431fdbcd144 last_write_checksum: sha1:f8f24a3ca09c1efb285d7a75ad3697d0128f47e2 @@ -1430,6 +1946,10 @@ trackedFiles: id: cd3a375787c5 last_write_checksum: sha1:993c19592ff7a5b9c2b4a60c5c25fea1b502f3e4 pristine_git_object: 2721f3c74c9bea6500e4edae3d377d0b04e79dce + src/funcs/billing-setup-payment.ts: + id: 4d2d8096862d + last_write_checksum: sha1:8104b79ac9e2922b97ae923454d0e41a24dd9d8f + pristine_git_object: e30ea0c1e60bcfce426ff277ce40ed8ef3e77adb src/funcs/billing-update.ts: id: 5c14ddfe1de0 last_write_checksum: sha1:950bf9530eee3aeaea9c249e533462ef741cdef0 @@ -1494,10 +2014,26 @@ trackedFiles: id: d2de3d7decac last_write_checksum: sha1:794d4f4235602275f58be74e1ac63c445ba1b74b pristine_git_object: fe5c26238dbcbfef4adffd82d978cfd3b613f96d + src/funcs/plans-create.ts: + id: d67d1d814264 + last_write_checksum: sha1:9bc6bf4d8e612c5a9a4914b3ed564bae963383f5 + pristine_git_object: 1f6e621322beeee49bf97b983620583849b50645 + src/funcs/plans-delete.ts: + id: 993ab1ed44c2 + last_write_checksum: sha1:b2b08ac5da98abb9ecda305f9456212e49b9786e + pristine_git_object: ec4c77c9c9d8031833d449ee5f2ca74adcba6a0b + src/funcs/plans-get.ts: + id: e8355eecb21d + last_write_checksum: sha1:5f124d65ade83eaa9466330fb2595ac7e437afd4 + pristine_git_object: 2af9cd13c1ebf24d598d03dac5a7f475642c556f src/funcs/plans-list.ts: id: ee004b08a26a - last_write_checksum: sha1:529fc2b9d479e83724908746421d749dffada2f9 - pristine_git_object: 87ff687d83ff92a4cdeea8a5e729c31384657c31 + last_write_checksum: sha1:134690a0e30a9deaacaff62b1d5486a1e25076ac + pristine_git_object: 3ba5652a7b770a940b0112c9a208f75a6de8642e + src/funcs/plans-update.ts: + id: 86e469e08973 + last_write_checksum: sha1:b12108c74307779f582ccd7a8819c1ea968847bf + pristine_git_object: 3d31c3c41956539a19ff1fee506ee43352995296 src/funcs/referrals-create-code.ts: id: f2088dbf847d last_write_checksum: sha1:f885e8dbe651c2f8c07a3297f31901277d9a57ed @@ -1532,8 +2068,8 @@ trackedFiles: pristine_git_object: 44be0eae8246521b230e8e711a88eff738fc015d src/lib/config.ts: id: 320761608fb3 - last_write_checksum: sha1:95b93f00aa70713e5c771f7378cd6bdc6d30919b - pristine_git_object: fe01b5cbc52a014ba04ea1d527f10f23e41297e7 + last_write_checksum: sha1:e089fe0dd70123f1e953214e92435db3ffa8f1e8 + pristine_git_object: c7ade4f8cbb6dd4a06541063fb1f5e710e60ded7 src/lib/dlv.ts: id: b1988214835a last_write_checksum: sha1:1dd3e3fbb4550c4bf31f5ef997faff355d6f3250 @@ -1608,16 +2144,16 @@ trackedFiles: pristine_git_object: b378971b319bfdc4b03988d5897df347bc70d004 src/models/billing-attach-op.ts: id: c0a94471ba75 - last_write_checksum: sha1:96c25a6a501d9b3935029cecc1e6a8f6472d7a77 - pristine_git_object: 821ac49b55569acce52fa12d43fe8005f4107bd1 + last_write_checksum: sha1:44ca45fd6ebc8bfb1cbfb63c1fc77461bbdd1fc7 + pristine_git_object: 9ec756afd868daf823e84ccf9d53dfb93cc50a58 src/models/billing-update-op.ts: id: e7371769c7ca - last_write_checksum: sha1:40b19554a26d1965e72ef2a48bc91d4ec000994c - pristine_git_object: f8402e63dcffc897ad39c101801bd7379ba88ec9 + last_write_checksum: sha1:071a9b6c4254fbe05c74e95d7945d71863704b26 + pristine_git_object: 6fd50000462856c84f28a2d1c49f82684b16bbd7 src/models/check-op.ts: id: 42085bda016a - last_write_checksum: sha1:1a0df40f6f47ccda0c01646b75663beefd558f96 - pristine_git_object: ce15f973527fd8d66d315a11345b66ff97a2d7c8 + last_write_checksum: sha1:1f9e9edaefce1df7169788f6937f9253fef71d6d + pristine_git_object: 87c3479860700f36a991257defaf968738ebd3f0 src/models/create-balance-op.ts: id: 537b8ff86863 last_write_checksum: sha1:9d1c1be246a8b9d0015b11184349fc404098a737 @@ -1630,6 +2166,10 @@ trackedFiles: id: 06f0161d677b last_write_checksum: sha1:2343ab517f362b3eaaa65e9039cec647ac497111 pristine_git_object: 74a7f92cc3812461d09b81b1a85c7275026f2162 + src/models/create-plan-op.ts: + id: e094d152f358 + last_write_checksum: sha1:83a1bbd42c0196d3cacc37652891cab3ed34d827 + pristine_git_object: 733c129fd447742628d8605638721c1bacab18c5 src/models/create-referral-code-op.ts: id: 745cd70e7a69 last_write_checksum: sha1:01ce64d29c3bd84e0c9bf1e6a979e7e493f10d67 @@ -1658,6 +2198,10 @@ trackedFiles: id: 9b373663842c last_write_checksum: sha1:313e1ae85324ede9fae14219aad35c981023dc60 pristine_git_object: 44281c2067fddcb0b19f275297a982345409deb5 + src/models/delete-plan-op.ts: + id: 3adb682d93b9 + last_write_checksum: sha1:777164c263fe33e42e4a8faee972b04bb4053b2f + pristine_git_object: fe9f3ba6325264cd07c3735c675e401a5d91a78e src/models/get-entity-op.ts: id: 7932a3cea5c1 last_write_checksum: sha1:360dbc9f831968c5bc9aa1bb3d7fca71612539e5 @@ -1670,14 +2214,18 @@ trackedFiles: id: 46f8f65a57f2 last_write_checksum: sha1:26098d6226df14b07bfd4b9c886000a2d3d82bd1 pristine_git_object: 438cc17a1f829e2d6ccede223c04cf0fef9f9838 + src/models/get-plan-op.ts: + id: 91c8f8dda7c8 + last_write_checksum: sha1:05a95b9e7b6f5a61e919bb671a5e07239802002f + pristine_git_object: 7379a72330a8e06554ffd37b88070c9de5807cc0 src/models/http-client-errors.ts: id: 5f17dcf0d62b last_write_checksum: sha1:994ced121c54fecd0af038ccfb7855fbfd3868ec pristine_git_object: b34f612124c797c2a1106b9735708f679a90b74f src/models/index.ts: id: f93644b0f37e - last_write_checksum: sha1:b03a3507e0c6f550681820d4aaa17a6e9f50ad9a - pristine_git_object: d896b711abe6df194dfba946f43191868965a5fe + last_write_checksum: sha1:343ea73d379a17c58566a8c873e8b1bdace88eaa + pristine_git_object: bf70667b0b961d147e8efe17b75ae24d560add11 src/models/list-customers-op.ts: id: b391692c8429 last_write_checksum: sha1:ffe17f0e9b360969793108bbf3404d9af5aff270 @@ -1692,24 +2240,24 @@ trackedFiles: pristine_git_object: 0f260a39a6ffe401412f6ad510b9e752acd42d3e src/models/list-plans-op.ts: id: 513cde894485 - last_write_checksum: sha1:df5e3899fe571eedffbebb6dd234e6d5b673b90e - pristine_git_object: 47f493799a73d1bf3413a9f38da73cc5076cdc05 + last_write_checksum: sha1:8331c0fc740adf06d25340d263c3086b59b854a0 + pristine_git_object: 7d208a676f5e6cd6c9cab4e0fd7786182925f7f2 src/models/open-customer-portal-op.ts: id: a003eb4172a9 last_write_checksum: sha1:5e672fc975a0336c963181042a770c2a43cbc0e3 pristine_git_object: 4a9318890026bc6e67a8a5b65dc596ae7f25f855 src/models/plan.ts: id: 9e9698a64fe7 - last_write_checksum: sha1:56d2d87477b4a626cc062a85c1c2f35d16cadbbc - pristine_git_object: 98bd4bfc4894cce108b7e1290849441288d033b8 + last_write_checksum: sha1:00c9f716a1551bf19a9331830b0f8309c8f9d9dd + pristine_git_object: 532f8e2229d1cb10d65bc53a1dce4dc385b78aa3 src/models/preview-attach-op.ts: id: 3efc6e3443a7 - last_write_checksum: sha1:20558306f11aa0fd45373dc3a92e73bdd1124d35 - pristine_git_object: a6e20f4ca5442617dd396c5bd3b1206642337755 + last_write_checksum: sha1:a15071a983ba541dcde675407602c9cf364a97b5 + pristine_git_object: 6e9a3651c41bb91079208e3c7a37c7077dbcd1b7 src/models/preview-update-op.ts: id: fcbbbf3b22ac - last_write_checksum: sha1:1946d63578852a42b4099e9e91752e071b2196e5 - pristine_git_object: af9a1c0d1ee9f35d87b2d189dd277f5859d4b124 + last_write_checksum: sha1:c3fb6a74929cc59028f28e08df474d44899a87a2 + pristine_git_object: 9b566805ef15e904eed39526c9d845975c142b46 src/models/redeem-referral-code-op.ts: id: 511bf73dc4c6 last_write_checksum: sha1:9ab6622018c82175ea98d2b26eadb4abf08f441a @@ -1726,6 +2274,10 @@ trackedFiles: id: d90c6c784ca5 last_write_checksum: sha1:f12af7291ebb0b6712532520d82e8d34fa86885a pristine_git_object: 3774cc1e9bbb80ac592990aa86f8d4a38ee51f29 + src/models/setup-payment-op.ts: + id: 0e97e999ff3c + last_write_checksum: sha1:0dbff6b93495fba3ec80fabc8dcd8422e5f9014a + pristine_git_object: 96a093bc941edb66a4a35841e3bdc2bf32063c8d src/models/track-op.ts: id: 5e6a750e8fec last_write_checksum: sha1:7572221a1632911507ed9d43408d9eb7fd02f7a5 @@ -1742,14 +2294,18 @@ trackedFiles: id: 7c27d245784e last_write_checksum: sha1:fca4d29e843ff678c6f85258ef40668a46da5e42 pristine_git_object: b1b8e80440aa378657be836028b4bf806c6949b4 + src/models/update-plan-op.ts: + id: 54b4f842d3b2 + last_write_checksum: sha1:613a8bedca02a45de64f557830871c5f4dba91a4 + pristine_git_object: d1b862dd22d1aace415da97e013b3a4d57346b4f src/sdk/balances.ts: id: 9ad229cb9d64 last_write_checksum: sha1:8e311bc69fcc76bfcef79c9621afa090f76c44cf pristine_git_object: a03539efdd5fe483e1836ed8ece8250b30d7536b src/sdk/billing.ts: id: 10905058c4ad - last_write_checksum: sha1:c5f948c90c3424da0da90fbd3827da7802d250f8 - pristine_git_object: f1210dada32c37d87d5991f4f5c61179178febcf + last_write_checksum: sha1:ed9877e249a0febf65eea059b18c78c9f72d0790 + pristine_git_object: 6d5e3103a53537c4859d36b23013a8903ab0f34a src/sdk/customers.ts: id: d33e193e0c00 last_write_checksum: sha1:3e4d794f7a68a5e1962483b578b5643b339581fe @@ -1772,8 +2328,8 @@ trackedFiles: pristine_git_object: ecac2264817bb369ff2dbf0f0e9029807e67ff77 src/sdk/plans.ts: id: c0cb8188cdc1 - last_write_checksum: sha1:03078cefd0187053db898e5619aaf19254c7b40f - pristine_git_object: c2146f217348864f34f15fb2a3329677f7ee0ed1 + last_write_checksum: sha1:b970e5940c053fed5735704e9ee346e8306f65f0 + pristine_git_object: 05783781bb918ed4b858e779ab12d97c224b527f src/sdk/referrals.ts: id: bf164167845c last_write_checksum: sha1:b73c1db6a419f5c7f6643382d5bc399204e95150 @@ -2117,9 +2673,11 @@ examples: parameters: header: x-api-version: "2.1" + requestBody: + application/json: {} responses: "200": - application/json: {"list": []} + application/json: {"list": [{"id": "pro", "name": "Pro Plan", "description": null, "group": null, "version": 1, "add_on": true, "auto_enable": false, "price": {"amount": 10, "interval": "month", "display": {"primary_text": ""}}, "items": [{"feature_id": "", "included": 100, "unlimited": false, "reset": {"interval": "month"}, "price": {"amount": 0.5, "interval": "month", "billing_units": 4969.56, "billing_method": "usage_based", "max_purchase": 5540.05}, "display": {"primary_text": ""}}, {"feature_id": "", "included": 0, "unlimited": false, "reset": null, "price": {"amount": 10, "interval": "month", "billing_units": 7445.4, "billing_method": "usage_based", "max_purchase": 66.27}, "display": {"primary_text": ""}}], "created_at": 3936.86, "env": "sandbox", "archived": false, "base_variant_id": ""}]} attach: speakeasy-default-attach: parameters: @@ -2304,10 +2862,10 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"customer_id": ""} + application/json: {"customer_id": "cus_123", "success_url": "https://example.com/account/billing"} responses: "200": - application/json: {"customer_id": "", "url": "https://courteous-emergent.name"} + application/json: {"customer_id": "cus_123", "url": "https://courteous-emergent.name"} previewBillingUpdate: speakeasy-default-preview-billing-update: parameters: @@ -2526,4 +3084,44 @@ examples: responses: "200": application/json: {"success": true} + createPlan: + speakeasy-default-create-plan: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"plan_id": "free_plan", "group": "", "name": "Free", "add_on": false, "auto_enable": true, "items": [{"feature_id": "messages", "included": 100, "reset": {"interval": "month"}}]} + responses: + "200": + application/json: {"id": "pro", "name": "Pro Plan", "description": null, "group": null, "version": 1, "add_on": false, "auto_enable": false, "price": {"amount": 10, "interval": "month", "display": {"primary_text": ""}}, "items": [{"feature_id": "", "included": 100, "unlimited": false, "reset": {"interval": "month"}, "price": {"amount": 0.5, "interval": "month", "billing_units": 4655.71, "billing_method": "prepaid", "max_purchase": 8104.69}, "display": {"primary_text": ""}}, {"feature_id": "", "included": 0, "unlimited": false, "reset": null, "price": {"amount": 10, "interval": "month", "billing_units": 5104.62, "billing_method": "prepaid", "max_purchase": null}, "display": {"primary_text": ""}}], "created_at": 1016.83, "env": "sandbox", "archived": false, "base_variant_id": ""} + getPlan: + speakeasy-default-get-plan: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"plan_id": "pro_plan"} + responses: + "200": + application/json: {"id": "pro", "name": "Pro Plan", "description": null, "group": null, "version": 1, "add_on": true, "auto_enable": false, "price": {"amount": 10, "interval": "month", "display": {"primary_text": ""}}, "items": [{"feature_id": "", "included": 100, "unlimited": false, "reset": {"interval": "month"}, "price": {"amount": 0.5, "interval": "month", "billing_units": 6216.63, "billing_method": "usage_based", "max_purchase": 9351.86}, "display": {"primary_text": ""}}, {"feature_id": "", "included": 0, "unlimited": false, "reset": null, "price": {"amount": 10, "interval": "month", "billing_units": 5235.67, "billing_method": "usage_based", "max_purchase": 9347.74}, "display": {"primary_text": ""}}], "created_at": 1101.73, "env": "sandbox", "archived": false, "base_variant_id": ""} + updatePlan: + speakeasy-default-update-plan: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"plan_id": "pro_plan", "group": "", "name": "Pro Plan (Updated)", "price": {"amount": 15, "interval": "month"}, "archived": false} + responses: + "200": + application/json: {"id": "pro", "name": "Pro Plan", "description": null, "group": null, "version": 1, "add_on": true, "auto_enable": true, "price": {"amount": 10, "interval": "month", "display": {"primary_text": ""}}, "items": [{"feature_id": "", "included": 100, "unlimited": false, "reset": {"interval": "month"}, "price": {"amount": 0.5, "interval": "month", "billing_units": 4113.21, "billing_method": "usage_based", "max_purchase": 5381.55}, "display": {"primary_text": ""}}, {"feature_id": "", "included": 0, "unlimited": false, "reset": null, "price": {"amount": 10, "interval": "month", "billing_units": 3844.43, "billing_method": "prepaid", "max_purchase": 1075.8}, "display": {"primary_text": ""}}], "created_at": 5898.47, "env": "sandbox", "archived": false, "base_variant_id": null} + deletePlan: + speakeasy-default-delete-plan: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"plan_id": "unused_plan", "all_versions": false} + responses: + "200": + application/json: {"success": false} examplesVersion: 1.0.2 diff --git a/packages/sdk/.speakeasy/gen.yaml b/packages/sdk/.speakeasy/gen.yaml index 2d3ca2171..d2475322b 100644 --- a/packages/sdk/.speakeasy/gen.yaml +++ b/packages/sdk/.speakeasy/gen.yaml @@ -33,7 +33,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false typescript: - version: 0.10.8 + version: 0.10.15 acceptHeaderEnum: false additionalDependencies: dependencies: {} diff --git a/packages/sdk/.speakeasy/out.openapi.yaml b/packages/sdk/.speakeasy/out.openapi.yaml index 7fb6be91f..506eb7383 100644 --- a/packages/sdk/.speakeasy/out.openapi.yaml +++ b/packages/sdk/.speakeasy/out.openapi.yaml @@ -479,28 +479,36 @@ components: properties: id: type: string + description: Unique identifier for the plan. name: type: string + description: Display name of the plan. description: anyOf: - type: string - type: "null" + description: Optional description of the plan. group: anyOf: - type: string - type: "null" + description: Group identifier for organizing related plans. Plans in the same group are mutually exclusive. version: type: number + description: Version number of the plan. Incremented when plan configuration changes. add_on: type: boolean + description: Whether this is an add-on plan that can be attached alongside a main plan. auto_enable: type: boolean + description: If true, this plan is automatically attached when a customer is created. Used for free plans. price: anyOf: - type: object properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -509,21 +517,27 @@ components: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. display: type: object properties: primary_text: type: string + description: Main display text (e.g. '$10' or '100 messages'). secondary_text: type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). required: - primary_text + description: Display text for showing this price in pricing pages. required: - amount - interval - type: "null" + description: Base recurring price for the plan. Null for free plans or usage-only plans. items: type: array items: @@ -531,6 +545,7 @@ components: properties: feature_id: type: string + description: The ID of the feature this item configures. feature: type: object properties: @@ -590,10 +605,13 @@ components: required: - id - type + description: The full feature object if expanded. included: type: number + description: Number of free units included. For consumable features, balance resets to this number each interval. unlimited: type: boolean + description: Whether the customer has unlimited access to this feature. reset: anyOf: - type: object @@ -609,17 +627,21 @@ components: - quarter - semi_annual - year + description: The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval - type: "null" + description: Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. price: anyOf: - type: object properties: amount: type: number + description: Price per billing_units after included usage is consumed. Mutually exclusive with tiers. tiers: type: array items: @@ -634,6 +656,7 @@ components: required: - to - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. interval: enum: - one_off @@ -642,33 +665,42 @@ components: - quarter - semi_annual - year + description: Billing interval for this price. For consumable features, should match reset.interval. interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number + description: Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage." max_purchase: anyOf: - type: number - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. required: - interval - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration for usage beyond included units. Null if feature is entirely free. display: type: object properties: primary_text: type: string + description: Main display text (e.g. '$10' or '100 messages'). secondary_text: type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). required: - primary_text + description: Display text for showing this item in pricing pages. rollover: type: object properties: @@ -676,83 +708,62 @@ components: anyOf: - type: number - type: "null" + description: Maximum rollover units. Null for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - max - expiry_duration_type - proration: - type: object - properties: - on_increase: - enum: - - bill_immediately - - prorate_immediately - - prorate_next_cycle - - bill_next_cycle - on_decrease: - enum: - - prorate - - prorate_immediately - - prorate_next_cycle - - none - - no_prorations + description: Rollover configuration for unused units. If set, unused included units roll over to the next period. required: - feature_id - included - unlimited - reset - price + description: Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. free_trial: type: object properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year + description: Unit of time for the trial duration ('day', 'month', 'year'). card_required: type: boolean + description: Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. required: - duration_length - duration_type - card_required + description: Free trial configuration. If set, new customers can try this plan before being charged. created_at: type: number + description: Unix timestamp (ms) when the plan was created. env: enum: - sandbox - live + description: Environment this plan belongs to ('sandbox' or 'live'). archived: type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to new customers. base_variant_id: anyOf: - type: string - type: "null" - customer_eligibility: - type: object - properties: - trial_available: - type: boolean - scenario: - enum: - - scheduled - - active - - new - - renew - - upgrade - - downgrade - - cancel - - expired - - past_due - required: - - scenario + description: If this is a variant, the ID of the base plan it was created from. required: - id - name @@ -1810,10 +1821,1123 @@ paths: x-speakeasy-name-override: delete parameters: - *a1 + /v1/plans.create: + post: + operationId: createPlan + summary: Create a plan + description: |- + Creates a new plan with optional base price and feature configurations. + + Use this to programmatically create pricing plans. See [How plans work](/documentation/pricing/plans) for concepts. + + @example + ```typescript + // Create a free plan with limited features + const response = await client.plans.create({ + planId: "free_plan", + name: "Free", + autoEnable: true, + items: [{"featureId":"messages","included":100,"reset":{"interval":"month"}}], + }); + ``` + + @example + ```typescript + // Create a paid plan with base price and usage-based feature + const response = await client.plans.create({ + planId: "pro_plan", + name: "Pro Plan", + price: {"amount":10,"interval":"month"}, + items: [{"featureId":"messages","included":1000,"reset":{"interval":"month"},"price":{"amount":0.01,"interval":"month","billingUnits":1,"billingMethod":"usage_based"}}], + }); + ``` + + @example + ```typescript + // Create a plan with prepaid seats + const response = await client.plans.create({ + planId: "team_plan", + name: "Team Plan", + price: {"amount":49,"interval":"month"}, + items: [{"featureId":"seats","included":5,"price":{"amount":10,"interval":"month","billingUnits":1,"billingMethod":"prepaid"}}], + }); + ``` + + @example + ```typescript + // Create an add-on plan + const response = await client.plans.create({ + planId: "analytics_addon", + name: "Advanced Analytics", + addOn: true, + price: {"amount":20,"interval":"month"}, + }); + ``` + + @example + ```typescript + // Create a plan with tiered pricing + const response = await client.plans.create({ planId: "api_plan", name: "API Plan", items: [{"featureId":"api_calls","included":1000,"reset":{"interval":"month"},"price":{"tiers":[{"to":10000,"amount":0.001},{"to":100000,"amount":0.0005},{"to":"inf","amount":0.0001}],"interval":"month","billingUnits":1,"billingMethod":"usage_based"}}] }); + ``` + + @example + ```typescript + // Create a plan with free trial + const response = await client.plans.create({ + planId: "premium_plan", + name: "Premium", + price: {"amount":99,"interval":"month"}, + freeTrial: {"durationLength":14,"durationType":"day","cardRequired":true}, + }); + ``` + + @param planId - The ID of the plan to create. + @param group - Group identifier for organizing related plans. Plans in the same group are mutually exclusive. (optional) + @param name - Display name of the plan. + @param description - Optional description of the plan. (optional) + @param addOn - If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. (optional) + @param autoEnable - If true, plan is automatically attached when a customer is created. Use for free tiers. (optional) + @param price - Base recurring price for the plan. Omit for free or usage-only plans. (optional) + @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional) + @param freeTrial - Free trial configuration. Customers can try this plan before being charged. (optional) + + @returns The created plan object. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: The ID of the plan to create. + group: + type: string + default: "" + description: Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + name: + type: string + minLength: 1 + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + default: null + description: Optional description of the plan. + add_on: + type: boolean + default: false + description: If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. + auto_enable: + type: boolean + default: false + description: If true, plan is automatically attached when a customer is created. Use for free tiers. + price: + type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + required: + - amount + - interval + description: Base recurring price for the plan. Omit for free or usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature to configure. + included: + type: number + description: Number of free units included. Balance resets to this each interval for consumable features. + unlimited: + type: boolean + description: If true, customer has unlimited access to this feature. + reset: + type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + description: Reset configuration for consumable features. Omit for non-consumable features like seats. + price: + type: object + properties: + amount: + type: number + description: Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval. For consumable features, should match reset.interval. + interval_count: + type: number + default: 1 + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go." + max_purchase: + type: number + description: Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + required: + - interval + - billing_method + description: Pricing for usage beyond included units. Omit for free features. + proration: + type: object + properties: + on_increase: + enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. + on_decrease: + enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + description: Credit behavior when quantity decreases mid-cycle. + required: + - on_increase + - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle quantity change billing. + rollover: + type: object + properties: + max: + type: number + description: Max rollover units. Omit for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - expiry_duration_type + description: Rollover config for unused units. If set, unused included units carry over. + required: + - feature_id + description: Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + default: month + description: Unit of time for the trial ('day', 'month', 'year'). + card_required: + type: boolean + default: true + description: If true, payment method required to start trial. Customer is charged after trial ends. + required: + - duration_length + description: Free trial configuration. Customers can try this plan before being charged. + required: + - plan_id + - name + title: CreatePlanParams + examples: + - plan_id: free_plan + name: Free + auto_enable: true + items: + - feature_id: messages + included: 100 + reset: + interval: month + - plan_id: pro_plan + name: Pro Plan + price: + amount: 10 + interval: month + items: + - feature_id: messages + included: 1000 + reset: + interval: month + price: + amount: 0.01 + interval: month + billing_units: 1 + billing_method: usage_based + - plan_id: team_plan + name: Team Plan + price: + amount: 49 + interval: month + items: + - feature_id: seats + included: 5 + price: + amount: 10 + interval: month + billing_units: 1 + billing_method: prepaid + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that can be attached to customers. + examples: + - id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + x-speakeasy-name-override: create + parameters: + - *a1 + /v1/plans.get: + post: + operationId: getPlan + summary: Get a plan + description: >- + Retrieves a single plan by its ID. + + + Use this to fetch the full configuration of a specific plan, including its features and pricing. + + + @example + + ```typescript + + // Get a plan by ID + + const response = await client.plans.get({ planId: "pro_plan" }); + + ``` + + + @example + + ```typescript + + // Get a specific version of a plan + + const response = await client.plans.get({ planId: "pro_plan", version: 2 }); + + ``` + + + @param planId - The ID of the plan to retrieve. + + @param version - The version of the plan to get. Defaults to the latest version. (optional) + + + @returns The plan object with its full configuration. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + description: The ID of the plan to retrieve. + version: + type: number + description: The version of the plan to get. Defaults to the latest version. + required: + - plan_id + title: GetPlanParams + examples: + - plan_id: pro_plan + - plan_id: pro_plan + version: 2 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that can be attached to customers. + examples: + - id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + x-speakeasy-name-override: get + parameters: + - *a1 /v1/plans.list: post: operationId: listPlans summary: List all plans + description: >- + Lists all plans in the current environment. + + + Use this to retrieve all plans for displaying pricing pages or managing plan configurations. + + + @returns A list of all plans with their pricing and feature configurations. tags: - plans requestBody: @@ -1825,10 +2949,18 @@ paths: properties: customer_id: type: string + description: Customer ID to include eligibility info (trial availability, attach scenario). entity_id: type: string + description: Entity ID for entity-scoped plans. include_archived: type: boolean + description: If true, includes archived plans in the response. + title: ListPlansParams + examples: + - {} + - customer_id: cus_123 + - include_archived: true responses: "200": description: OK @@ -1840,12 +2972,1073 @@ paths: list: type: array items: - $ref: "#/components/schemas/Plan" + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that can be attached to customers. required: - list + examples: + - list: + - id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null x-speakeasy-name-override: list parameters: - *a1 + /v1/plans.update: + post: + operationId: updatePlan + summary: Update a plan + description: |- + Updates an existing plan. Creates a new version unless `disableVersion` is set. + + Use this to modify plan properties, pricing, or feature configurations. See [Adding features to plans](/documentation/pricing/plan-features) for item configuration. + + @example + ```typescript + // Update plan name and price + const response = await client.plans.update({ planId: "pro_plan", name: "Pro Plan (Updated)", price: {"amount":15,"interval":"month"} }); + ``` + + @example + ```typescript + // Add a feature to an existing plan + const response = await client.plans.update({ planId: "pro_plan", items: [{"featureId":"messages","included":1000,"reset":{"interval":"month"}},{"featureId":"storage","included":10,"reset":{"interval":"month"}}] }); + ``` + + @example + ```typescript + // Remove the base price (make usage-only) + const response = await client.plans.update({ planId: "pro_plan", price: null }); + ``` + + @example + ```typescript + // Archive a plan + const response = await client.plans.update({ planId: "old_plan", archived: true }); + ``` + + @example + ```typescript + // Update feature's included amount + const response = await client.plans.update({ planId: "pro_plan", items: [{"featureId":"messages","included":2000,"reset":{"interval":"month"}}] }); + ``` + + @param planId - The ID of the plan to update. + @param group - Group identifier for organizing related plans. Plans in the same group are mutually exclusive. (optional) + @param name - Display name of the plan. (optional) + @param addOn - Whether the plan is an add-on. (optional) + @param autoEnable - Whether the plan is automatically enabled. (optional) + @param price - The price of the plan. Set to null to remove the base price. (optional) + @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional) + @param freeTrial - The free trial of the plan. Set to null to remove the free trial. (optional) + @param newPlanId - The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. (optional) + + @returns The updated plan object. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: The ID of the plan to update. + group: + type: string + default: "" + description: Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + name: + type: string + minLength: 1 + description: Display name of the plan. + description: + type: string + add_on: + type: boolean + description: Whether the plan is an add-on. + auto_enable: + type: boolean + description: Whether the plan is automatically enabled. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + required: + - amount + - interval + - type: "null" + description: The price of the plan. Set to null to remove the base price. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature to configure. + included: + type: number + description: Number of free units included. Balance resets to this each interval for consumable features. + unlimited: + type: boolean + description: If true, customer has unlimited access to this feature. + reset: + type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + description: Reset configuration for consumable features. Omit for non-consumable features like seats. + price: + type: object + properties: + amount: + type: number + description: Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval. For consumable features, should match reset.interval. + interval_count: + type: number + default: 1 + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go." + max_purchase: + type: number + description: Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + required: + - interval + - billing_method + description: Pricing for usage beyond included units. Omit for free features. + proration: + type: object + properties: + on_increase: + enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. + on_decrease: + enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + description: Credit behavior when quantity decreases mid-cycle. + required: + - on_increase + - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle quantity change billing. + rollover: + type: object + properties: + max: + type: number + description: Max rollover units. Omit for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - expiry_duration_type + description: Rollover config for unused units. If set, unused included units carry over. + required: + - feature_id + description: Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. + free_trial: + anyOf: + - type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + default: month + description: Unit of time for the trial ('day', 'month', 'year'). + card_required: + type: boolean + default: true + description: If true, payment method required to start trial. Customer is charged after trial ends. + required: + - duration_length + - type: "null" + description: The free trial of the plan. Set to null to remove the free trial. + version: + type: number + archived: + type: boolean + default: false + new_plan_id: + type: string + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. + required: + - plan_id + title: UpdatePlanParams + examples: + - plan_id: pro_plan + name: Pro Plan (Updated) + price: + amount: 15 + interval: month + - plan_id: pro_plan + price: null + - plan_id: old_plan + archived: true + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: Unique identifier for the plan. + name: + type: string + description: Display name of the plan. + description: + anyOf: + - type: string + - type: "null" + description: Optional description of the plan. + group: + anyOf: + - type: string + - type: "null" + description: Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + version: + type: number + description: Version number of the plan. Incremented when plan configuration changes. + add_on: + type: boolean + description: Whether this is an add-on plan that can be attached alongside a main plan. + auto_enable: + type: boolean + description: If true, this plan is automatically attached when a customer is created. Used for free plans. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Base price amount for the plan. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval (e.g. 'month', 'year'). + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this price in pricing pages. + required: + - amount + - interval + - type: "null" + description: Base recurring price for the plan. Null for free plans or usage-only plans. + items: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature this item configures. + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + description: The full feature object if expanded. + included: + type: number + description: Number of free units included. For consumable features, balance resets to this number each interval. + unlimited: + type: boolean + description: Whether the customer has unlimited access to this feature. + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + description: The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + interval_count: + type: number + description: Number of intervals between resets. Defaults to 1. + required: + - interval + - type: "null" + description: Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + description: Billing interval for this price. For consumable features, should match reset.interval. + interval_count: + type: number + description: Number of intervals per billing cycle. Defaults to 1. + billing_units: + type: number + description: Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + billing_method: + enum: + - prepaid + - usage_based + description: "'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage." + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration for usage beyond included units. Null if feature is entirely free. + display: + type: object + properties: + primary_text: + type: string + description: Main display text (e.g. '$10' or '100 messages'). + secondary_text: + type: string + description: Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + required: + - primary_text + description: Display text for showing this item in pricing pages. + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + description: Maximum rollover units. Null for unlimited rollover. + expiry_duration_type: + enum: + - month + - forever + description: When rolled over units expire. + expiry_duration_length: + type: number + description: Number of periods before expiry. + required: + - max + - expiry_duration_type + description: Rollover configuration for unused units. If set, unused included units roll over to the next period. + required: + - feature_id + - included + - unlimited + - reset + - price + description: Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. + free_trial: + type: object + properties: + duration_length: + type: number + description: Number of duration_type periods the trial lasts. + duration_type: + enum: + - day + - month + - year + description: Unit of time for the trial duration ('day', 'month', 'year'). + card_required: + type: boolean + description: Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + required: + - duration_length + - duration_type + - card_required + description: Free trial configuration. If set, new customers can try this plan before being charged. + created_at: + type: number + description: Unix timestamp (ms) when the plan was created. + env: + enum: + - sandbox + - live + description: Environment this plan belongs to ('sandbox' or 'live'). + archived: + type: boolean + description: Whether the plan is archived. Archived plans cannot be attached to new customers. + base_variant_id: + anyOf: + - type: string + - type: "null" + description: If this is a variant, the ID of the base plan it was created from. + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + description: A plan defines a set of features, pricing, and entitlements that can be attached to customers. + examples: + - id: pro + name: Pro Plan + description: null + group: null + version: 1 + addOn: false + autoEnable: false + price: + amount: 10 + interval: month + display: + primaryText: $10 + secondaryText: per month + items: + - featureId: messages + included: 100 + unlimited: false + reset: + interval: month + price: + amount: 0.5 + interval: month + billingUnits: 100 + billingMethod: usage_based + maxPurchase: null + display: + primaryText: 100 messages + secondaryText: then $0.5 per 100 messages + - featureId: users + included: 0 + unlimited: false + reset: null + price: + amount: 10 + interval: month + billingUnits: 1 + billingMethod: prepaid + maxPurchase: null + display: + primaryText: $10 per Users + createdAt: 1771513979217 + env: sandbox + archived: false + baseVariantId: null + x-speakeasy-name-override: update + parameters: + - *a1 + /v1/plans.delete: + post: + operationId: deletePlan + summary: Delete a plan + description: >- + Deletes a plan by its ID. + + + Use this to permanently remove a plan. Plans with active customers cannot be deleted - archive them instead. + + + @example + + ```typescript + + // Delete a plan + + const response = await client.plans.delete({ planId: "unused_plan" }); + + ``` + + + @example + + ```typescript + + // Delete all versions of a plan + + const response = await client.plans.delete({ planId: "legacy_plan", allVersions: true }); + + ``` + + + @param planId - The ID of the plan to delete. + + @param allVersions - If true, deletes all versions of the plan. Otherwise, only deletes the latest version. (optional) + + + @returns A success flag indicating the plan was deleted. + tags: + - plans + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plan_id: + type: string + minLength: 1 + description: The ID of the plan to delete. + all_versions: + type: boolean + default: false + description: If true, deletes all versions of the plan. Otherwise, only deletes the latest version. + required: + - plan_id + title: DeletePlanParams + examples: + - plan_id: unused_plan + - plan_id: legacy_plan + all_versions: true + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + required: + - success + x-speakeasy-name-override: delete + parameters: + - *a1 /v1/features.create: post: operationId: createFeature @@ -2641,15 +4834,18 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is charged after trial ends. required: - duration_length - type: "null" @@ -2663,6 +4859,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -2671,8 +4868,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -2684,10 +4883,13 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -2702,15 +4904,19 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or 'tiers' is required. tiers: type: array items: @@ -2725,6 +4931,7 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -2733,21 +4940,27 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -2757,6 +4970,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -2764,22 +4978,28 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. @@ -3007,15 +5227,18 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is charged after trial ends. required: - duration_length - type: "null" @@ -3029,6 +5252,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -3037,8 +5261,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -3050,10 +5276,13 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -3068,15 +5297,19 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or 'tiers' is required. tiers: type: array items: @@ -3091,6 +5324,7 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -3099,21 +5333,27 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -3123,6 +5363,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -3130,22 +5371,28 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. @@ -3397,15 +5644,18 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is charged after trial ends. required: - duration_length - type: "null" @@ -3419,6 +5669,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -3427,8 +5678,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -3440,10 +5693,13 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -3458,15 +5714,19 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or 'tiers' is required. tiers: type: array items: @@ -3481,6 +5741,7 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -3489,21 +5750,27 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -3513,6 +5780,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -3520,22 +5788,28 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. @@ -3739,15 +6013,18 @@ paths: properties: duration_length: type: number + description: Number of duration_type periods the trial lasts. duration_type: enum: - day - month - year default: month + description: Unit of time for the trial ('day', 'month', 'year'). card_required: type: boolean default: true + description: If true, payment method required to start trial. Customer is charged after trial ends. required: - duration_length - type: "null" @@ -3761,6 +6038,7 @@ paths: properties: amount: type: number + description: Base price amount for the plan. interval: enum: - one_off @@ -3769,8 +6047,10 @@ paths: - quarter - semi_annual - year + description: Billing interval (e.g. 'month', 'year'). interval_count: type: number + description: Number of intervals per billing cycle. Defaults to 1. required: - amount - interval @@ -3782,10 +6062,13 @@ paths: properties: feature_id: type: string + description: The ID of the feature to configure. included: type: number + description: Number of free units included. Balance resets to this each interval for consumable features. unlimited: type: boolean + description: If true, customer has unlimited access to this feature. reset: type: object properties: @@ -3800,15 +6083,19 @@ paths: - quarter - semi_annual - year + description: Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. interval_count: type: number + description: Number of intervals between resets. Defaults to 1. required: - interval + description: Reset configuration for consumable features. Omit for non-consumable features like seats. price: type: object properties: amount: type: number + description: Price per billing_units after included usage. Either 'amount' or 'tiers' is required. tiers: type: array items: @@ -3823,6 +6110,7 @@ paths: required: - to - amount + description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. interval: enum: - one_off @@ -3831,21 +6119,27 @@ paths: - quarter - semi_annual - year + description: Billing interval. For consumable features, should match reset.interval. interval_count: type: number default: 1 + description: Number of intervals per billing cycle. Defaults to 1. billing_units: type: number default: 1 + description: Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). billing_method: enum: - prepaid - usage_based + description: "'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go." max_purchase: type: number + description: Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. required: - interval - billing_method + description: Pricing for usage beyond included units. Omit for free features. proration: type: object properties: @@ -3855,6 +6149,7 @@ paths: - prorate_immediately - prorate_next_cycle - bill_next_cycle + description: Billing behavior when quantity increases mid-cycle. on_decrease: enum: - prorate @@ -3862,22 +6157,28 @@ paths: - prorate_next_cycle - none - no_prorations + description: Credit behavior when quantity decreases mid-cycle. required: - on_increase - on_decrease + description: Proration settings for prepaid features. Controls mid-cycle quantity change billing. rollover: type: object properties: max: type: number + description: Max rollover units. Omit for unlimited rollover. expiry_duration_type: enum: - month - forever + description: When rolled over units expire. expiry_duration_length: type: number + description: Number of periods before expiry. required: - expiry_duration_type + description: Rollover config for unused units. If set, unused included units carry over. required: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. @@ -4053,6 +6354,62 @@ paths: x-speakeasy-name-override: openCustomerPortal parameters: - *a1 + /v1/billing.setup_payment: + post: + operationId: setupPayment + description: Create a payment setup session for a customer to add or update their payment method. + tags: + - billing + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer + success_url: + type: string + description: URL to redirect to after successful payment setup. Must start with either http:// or https:// + customer_data: + $ref: "#/components/schemas/CustomerData" + checkout_session_params: + type: object + propertyNames: + type: string + additionalProperties: {} + description: Additional parameters for the checkout session + required: + - customer_id + title: SetupPaymentParams + examples: + - customer_id: cus_123 + success_url: https://example.com/account/billing + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer + url: + type: string + description: URL to the payment setup page + required: + - customer_id + - url + examples: + - customer_id: cus_123 + payment_url: https://checkout.stripe.com/... + x-speakeasy-name-override: setupPayment + parameters: + - *a1 /v1/balances.create: post: operationId: createBalance diff --git a/packages/sdk/.speakeasy/workflow.lock b/packages/sdk/.speakeasy/workflow.lock index 7a7e55f66..928d749ca 100644 --- a/packages/sdk/.speakeasy/workflow.lock +++ b/packages/sdk/.speakeasy/workflow.lock @@ -9,8 +9,8 @@ sources: - 2.1.0 Autumn API Stripped: sourceNamespace: autumn-api-stripped - sourceRevisionDigest: sha256:5106466bc2746351ee3eb81772902338bd3df888ea234b404b304876f05fbe8a - sourceBlobDigest: sha256:6c3f4f23ec1ce0e0f8321892c938fa90c788be02c7f3a1519f05c32d28b6a205 + sourceRevisionDigest: sha256:b8255e040f0927a81289f8b2cb29c15a532c9fa9cf556ace5635db15d1d5e3d3 + sourceBlobDigest: sha256:1a567917ebff7879f182db728eb6fa3ff6270bbb46c5e546b30e758a52aa8509 tags: - latest - 2.1.0 @@ -25,10 +25,10 @@ targets: autumn-python: source: Autumn API Stripped sourceNamespace: autumn-api-stripped - sourceRevisionDigest: sha256:5106466bc2746351ee3eb81772902338bd3df888ea234b404b304876f05fbe8a - sourceBlobDigest: sha256:6c3f4f23ec1ce0e0f8321892c938fa90c788be02c7f3a1519f05c32d28b6a205 + sourceRevisionDigest: sha256:b8255e040f0927a81289f8b2cb29c15a532c9fa9cf556ace5635db15d1d5e3d3 + sourceBlobDigest: sha256:1a567917ebff7879f182db728eb6fa3ff6270bbb46c5e546b30e758a52aa8509 codeSamplesNamespace: autumn-api-python-code-samples - codeSamplesRevisionDigest: sha256:6d20be3b4912b45ac5056df41762af656d7d253b9560790d9bab52c0b36cea31 + codeSamplesRevisionDigest: sha256:ce4215f239e65976dbfffcd7e5d76f506dc0ba33a3046a99f846502ff192fe71 workflow: workflowVersion: 1.0.0 speakeasyVersion: pinned diff --git a/packages/sdk/README.md b/packages/sdk/README.md index 8d894775e..ef8fc66bf 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -329,6 +329,7 @@ const response = await client.billing.previewUpdate({ customerId: "cus_123", pla @returns A preview response with line items showing prorated charges or credits for the proposed changes. * [openCustomerPortal](docs/sdks/billing/README.md#opencustomerportal) - Create a billing portal session for a customer to manage their subscription. +* [setupPayment](docs/sdks/billing/README.md#setuppayment) - Create a payment setup session for a customer to add or update their payment method. ### [Customers](docs/sdks/customers/README.md) @@ -512,7 +513,11 @@ const response = await client.features.delete({ featureId: "old-feature" }); ### [Plans](docs/sdks/plans/README.md) +* [create](docs/sdks/plans/README.md#create) - Create a plan +* [get](docs/sdks/plans/README.md#get) - Get a plan * [list](docs/sdks/plans/README.md#list) - List all plans +* [update](docs/sdks/plans/README.md#update) - Update a plan +* [delete](docs/sdks/plans/README.md#delete) - Delete a plan ### [Referrals](docs/sdks/referrals/README.md) @@ -623,6 +628,7 @@ const response = await client.billing.previewUpdate({ customerId: "cus_123", pla @param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) @returns A preview response with line items showing prorated charges or credits for the proposed changes. +- [`billingSetupPayment`](docs/sdks/billing/README.md#setuppayment) - Create a payment setup session for a customer to add or update their payment method. - [`billingUpdate`](docs/sdks/billing/README.md#update) - Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings. @@ -855,7 +861,11 @@ const response = await client.features.update({ featureId: "deprecated-feature", @param newFeatureId - The new ID of the feature. Feature ID can only be updated if it's not being used by any customers. (optional) @returns The updated feature object. +- [`plansCreate`](docs/sdks/plans/README.md#create) - Create a plan +- [`plansDelete`](docs/sdks/plans/README.md#delete) - Delete a plan +- [`plansGet`](docs/sdks/plans/README.md#get) - Get a plan - [`plansList`](docs/sdks/plans/README.md#list) - List all plans +- [`plansUpdate`](docs/sdks/plans/README.md#update) - Update a plan - [`referralsCreateCode`](docs/sdks/referrals/README.md#createcode) - Create or fetch a referral code for a customer in a referral program. - [`referralsRedeemCode`](docs/sdks/referrals/README.md#redeemcode) - Redeem a referral code for a customer. - [`track`](docs/sdks/autumn/README.md#track) - Records usage for a customer feature and returns updated balances. diff --git a/packages/sdk/docs/models/billing-attach-billing-method.md b/packages/sdk/docs/models/billing-attach-billing-method.md index e1d23e8bd..47e22e393 100644 --- a/packages/sdk/docs/models/billing-attach-billing-method.md +++ b/packages/sdk/docs/models/billing-attach-billing-method.md @@ -1,5 +1,7 @@ # BillingAttachBillingMethod +'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-attach-duration-type.md b/packages/sdk/docs/models/billing-attach-duration-type.md index a94cab6cc..3256d505f 100644 --- a/packages/sdk/docs/models/billing-attach-duration-type.md +++ b/packages/sdk/docs/models/billing-attach-duration-type.md @@ -1,5 +1,7 @@ # BillingAttachDurationType +Unit of time for the trial ('day', 'month', 'year'). + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-attach-expiry-duration-type.md b/packages/sdk/docs/models/billing-attach-expiry-duration-type.md index e16b20e54..e2e0d2c3b 100644 --- a/packages/sdk/docs/models/billing-attach-expiry-duration-type.md +++ b/packages/sdk/docs/models/billing-attach-expiry-duration-type.md @@ -1,5 +1,7 @@ # BillingAttachExpiryDurationType +When rolled over units expire. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-attach-free-trial.md b/packages/sdk/docs/models/billing-attach-free-trial.md index e0a6c6a13..8833a7da2 100644 --- a/packages/sdk/docs/models/billing-attach-free-trial.md +++ b/packages/sdk/docs/models/billing-attach-free-trial.md @@ -12,8 +12,8 @@ let value: BillingAttachFreeTrial = { ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `durationLength` | *number* | :heavy_check_mark: | N/A | -| `durationType` | [models.BillingAttachDurationType](../models/billing-attach-duration-type.md) | :heavy_minus_sign: | N/A | -| `cardRequired` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `durationLength` | *number* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `durationType` | [models.BillingAttachDurationType](../models/billing-attach-duration-type.md) | :heavy_minus_sign: | Unit of time for the trial ('day', 'month', 'year'). | +| `cardRequired` | *boolean* | :heavy_minus_sign: | If true, payment method required to start trial. Customer is charged after trial ends. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-item-price-interval.md b/packages/sdk/docs/models/billing-attach-item-price-interval.md index 49eca39a4..867bd77fb 100644 --- a/packages/sdk/docs/models/billing-attach-item-price-interval.md +++ b/packages/sdk/docs/models/billing-attach-item-price-interval.md @@ -1,5 +1,7 @@ # BillingAttachItemPriceInterval +Billing interval. For consumable features, should match reset.interval. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-attach-item-price.md b/packages/sdk/docs/models/billing-attach-item-price.md index 010673667..441b4c462 100644 --- a/packages/sdk/docs/models/billing-attach-item-price.md +++ b/packages/sdk/docs/models/billing-attach-item-price.md @@ -1,5 +1,7 @@ # BillingAttachItemPrice +Pricing for usage beyond included units. Omit for free features. + ## Example Usage ```typescript @@ -13,12 +15,12 @@ let value: BillingAttachItemPrice = { ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.BillingAttachTier](../models/billing-attach-tier.md)[] | :heavy_minus_sign: | N/A | -| `interval` | [models.BillingAttachItemPriceInterval](../models/billing-attach-item-price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_minus_sign: | N/A | -| `billingMethod` | [models.BillingAttachBillingMethod](../models/billing-attach-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `amount` | *number* | :heavy_minus_sign: | Price per billing_units after included usage. Either 'amount' or 'tiers' is required. | +| `tiers` | [models.BillingAttachTier](../models/billing-attach-tier.md)[] | :heavy_minus_sign: | Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. | +| `interval` | [models.BillingAttachItemPriceInterval](../models/billing-attach-item-price-interval.md) | :heavy_check_mark: | Billing interval. For consumable features, should match reset.interval. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billingUnits` | *number* | :heavy_minus_sign: | Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). | +| `billingMethod` | [models.BillingAttachBillingMethod](../models/billing-attach-billing-method.md) | :heavy_check_mark: | 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. | +| `maxPurchase` | *number* | :heavy_minus_sign: | Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-item.md b/packages/sdk/docs/models/billing-attach-item.md index a3fd13d00..54fc76810 100644 --- a/packages/sdk/docs/models/billing-attach-item.md +++ b/packages/sdk/docs/models/billing-attach-item.md @@ -12,12 +12,12 @@ let value: BillingAttachItem = { ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `included` | *number* | :heavy_minus_sign: | N/A | -| `unlimited` | *boolean* | :heavy_minus_sign: | N/A | -| `reset` | [models.BillingAttachReset](../models/billing-attach-reset.md) | :heavy_minus_sign: | N/A | -| `price` | [models.BillingAttachItemPrice](../models/billing-attach-item-price.md) | :heavy_minus_sign: | N/A | -| `proration` | [models.BillingAttachProration](../models/billing-attach-proration.md) | :heavy_minus_sign: | N/A | -| `rollover` | [models.BillingAttachRollover](../models/billing-attach-rollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature to configure. | +| `included` | *number* | :heavy_minus_sign: | Number of free units included. Balance resets to this each interval for consumable features. | +| `unlimited` | *boolean* | :heavy_minus_sign: | If true, customer has unlimited access to this feature. | +| `reset` | [models.BillingAttachReset](../models/billing-attach-reset.md) | :heavy_minus_sign: | Reset configuration for consumable features. Omit for non-consumable features like seats. | +| `price` | [models.BillingAttachItemPrice](../models/billing-attach-item-price.md) | :heavy_minus_sign: | Pricing for usage beyond included units. Omit for free features. | +| `proration` | [models.BillingAttachProration](../models/billing-attach-proration.md) | :heavy_minus_sign: | Proration settings for prepaid features. Controls mid-cycle quantity change billing. | +| `rollover` | [models.BillingAttachRollover](../models/billing-attach-rollover.md) | :heavy_minus_sign: | Rollover config for unused units. If set, unused included units carry over. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-on-decrease.md b/packages/sdk/docs/models/billing-attach-on-decrease.md index fa3fe1982..df06a306a 100644 --- a/packages/sdk/docs/models/billing-attach-on-decrease.md +++ b/packages/sdk/docs/models/billing-attach-on-decrease.md @@ -1,5 +1,7 @@ # BillingAttachOnDecrease +Credit behavior when quantity decreases mid-cycle. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-attach-on-increase.md b/packages/sdk/docs/models/billing-attach-on-increase.md index b299a19af..8d175b5f3 100644 --- a/packages/sdk/docs/models/billing-attach-on-increase.md +++ b/packages/sdk/docs/models/billing-attach-on-increase.md @@ -1,5 +1,7 @@ # BillingAttachOnIncrease +Billing behavior when quantity increases mid-cycle. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-attach-price-interval.md b/packages/sdk/docs/models/billing-attach-price-interval.md index 76dfdb9c5..1a90db121 100644 --- a/packages/sdk/docs/models/billing-attach-price-interval.md +++ b/packages/sdk/docs/models/billing-attach-price-interval.md @@ -1,5 +1,7 @@ # BillingAttachPriceInterval +Billing interval (e.g. 'month', 'year'). + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-attach-price.md b/packages/sdk/docs/models/billing-attach-price.md index b903dbde0..3913182fa 100644 --- a/packages/sdk/docs/models/billing-attach-price.md +++ b/packages/sdk/docs/models/billing-attach-price.md @@ -15,6 +15,6 @@ let value: BillingAttachPrice = { | Field | Type | Required | Description | | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_check_mark: | N/A | -| `interval` | [models.BillingAttachPriceInterval](../models/billing-attach-price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `amount` | *number* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.BillingAttachPriceInterval](../models/billing-attach-price-interval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-proration.md b/packages/sdk/docs/models/billing-attach-proration.md index 3715830c1..c4a19c72c 100644 --- a/packages/sdk/docs/models/billing-attach-proration.md +++ b/packages/sdk/docs/models/billing-attach-proration.md @@ -1,5 +1,7 @@ # BillingAttachProration +Proration settings for prepaid features. Controls mid-cycle quantity change billing. + ## Example Usage ```typescript @@ -15,5 +17,5 @@ let value: BillingAttachProration = { | Field | Type | Required | Description | | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `onIncrease` | [models.BillingAttachOnIncrease](../models/billing-attach-on-increase.md) | :heavy_check_mark: | N/A | -| `onDecrease` | [models.BillingAttachOnDecrease](../models/billing-attach-on-decrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| `onIncrease` | [models.BillingAttachOnIncrease](../models/billing-attach-on-increase.md) | :heavy_check_mark: | Billing behavior when quantity increases mid-cycle. | +| `onDecrease` | [models.BillingAttachOnDecrease](../models/billing-attach-on-decrease.md) | :heavy_check_mark: | Credit behavior when quantity decreases mid-cycle. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-reset-interval.md b/packages/sdk/docs/models/billing-attach-reset-interval.md index 35cec40f2..f6544ea68 100644 --- a/packages/sdk/docs/models/billing-attach-reset-interval.md +++ b/packages/sdk/docs/models/billing-attach-reset-interval.md @@ -1,5 +1,7 @@ # BillingAttachResetInterval +Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-attach-reset.md b/packages/sdk/docs/models/billing-attach-reset.md index 1c1f2244b..48c99528c 100644 --- a/packages/sdk/docs/models/billing-attach-reset.md +++ b/packages/sdk/docs/models/billing-attach-reset.md @@ -1,5 +1,7 @@ # BillingAttachReset +Reset configuration for consumable features. Omit for non-consumable features like seats. + ## Example Usage ```typescript @@ -12,7 +14,7 @@ let value: BillingAttachReset = { ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `interval` | [models.BillingAttachResetInterval](../models/billing-attach-reset-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `interval` | [models.BillingAttachResetInterval](../models/billing-attach-reset-interval.md) | :heavy_check_mark: | Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-rollover.md b/packages/sdk/docs/models/billing-attach-rollover.md index 6fd6c72b7..dcc8b723d 100644 --- a/packages/sdk/docs/models/billing-attach-rollover.md +++ b/packages/sdk/docs/models/billing-attach-rollover.md @@ -1,5 +1,7 @@ # BillingAttachRollover +Rollover config for unused units. If set, unused included units carry over. + ## Example Usage ```typescript @@ -14,6 +16,6 @@ let value: BillingAttachRollover = { | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `max` | *number* | :heavy_minus_sign: | N/A | -| `expiryDurationType` | [models.BillingAttachExpiryDurationType](../models/billing-attach-expiry-duration-type.md) | :heavy_check_mark: | N/A | -| `expiryDurationLength` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `max` | *number* | :heavy_minus_sign: | Max rollover units. Omit for unlimited rollover. | +| `expiryDurationType` | [models.BillingAttachExpiryDurationType](../models/billing-attach-expiry-duration-type.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiryDurationLength` | *number* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-update-billing-method.md b/packages/sdk/docs/models/billing-update-billing-method.md index cf04e983d..5d5802778 100644 --- a/packages/sdk/docs/models/billing-update-billing-method.md +++ b/packages/sdk/docs/models/billing-update-billing-method.md @@ -1,5 +1,7 @@ # BillingUpdateBillingMethod +'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-update-duration-type.md b/packages/sdk/docs/models/billing-update-duration-type.md index 70965bba3..5cee91272 100644 --- a/packages/sdk/docs/models/billing-update-duration-type.md +++ b/packages/sdk/docs/models/billing-update-duration-type.md @@ -1,5 +1,7 @@ # BillingUpdateDurationType +Unit of time for the trial ('day', 'month', 'year'). + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-update-expiry-duration-type.md b/packages/sdk/docs/models/billing-update-expiry-duration-type.md index b1b13de32..514847814 100644 --- a/packages/sdk/docs/models/billing-update-expiry-duration-type.md +++ b/packages/sdk/docs/models/billing-update-expiry-duration-type.md @@ -1,5 +1,7 @@ # BillingUpdateExpiryDurationType +When rolled over units expire. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-update-free-trial.md b/packages/sdk/docs/models/billing-update-free-trial.md index 14c590858..899dfe7dd 100644 --- a/packages/sdk/docs/models/billing-update-free-trial.md +++ b/packages/sdk/docs/models/billing-update-free-trial.md @@ -12,8 +12,8 @@ let value: BillingUpdateFreeTrial = { ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `durationLength` | *number* | :heavy_check_mark: | N/A | -| `durationType` | [models.BillingUpdateDurationType](../models/billing-update-duration-type.md) | :heavy_minus_sign: | N/A | -| `cardRequired` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `durationLength` | *number* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `durationType` | [models.BillingUpdateDurationType](../models/billing-update-duration-type.md) | :heavy_minus_sign: | Unit of time for the trial ('day', 'month', 'year'). | +| `cardRequired` | *boolean* | :heavy_minus_sign: | If true, payment method required to start trial. Customer is charged after trial ends. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-update-item-price-interval.md b/packages/sdk/docs/models/billing-update-item-price-interval.md index 327ed65b8..116ca195c 100644 --- a/packages/sdk/docs/models/billing-update-item-price-interval.md +++ b/packages/sdk/docs/models/billing-update-item-price-interval.md @@ -1,5 +1,7 @@ # BillingUpdateItemPriceInterval +Billing interval. For consumable features, should match reset.interval. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-update-item-price.md b/packages/sdk/docs/models/billing-update-item-price.md index 02504270e..fdb027e23 100644 --- a/packages/sdk/docs/models/billing-update-item-price.md +++ b/packages/sdk/docs/models/billing-update-item-price.md @@ -1,5 +1,7 @@ # BillingUpdateItemPrice +Pricing for usage beyond included units. Omit for free features. + ## Example Usage ```typescript @@ -13,12 +15,12 @@ let value: BillingUpdateItemPrice = { ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.BillingUpdateTier](../models/billing-update-tier.md)[] | :heavy_minus_sign: | N/A | -| `interval` | [models.BillingUpdateItemPriceInterval](../models/billing-update-item-price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_minus_sign: | N/A | -| `billingMethod` | [models.BillingUpdateBillingMethod](../models/billing-update-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `amount` | *number* | :heavy_minus_sign: | Price per billing_units after included usage. Either 'amount' or 'tiers' is required. | +| `tiers` | [models.BillingUpdateTier](../models/billing-update-tier.md)[] | :heavy_minus_sign: | Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. | +| `interval` | [models.BillingUpdateItemPriceInterval](../models/billing-update-item-price-interval.md) | :heavy_check_mark: | Billing interval. For consumable features, should match reset.interval. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billingUnits` | *number* | :heavy_minus_sign: | Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). | +| `billingMethod` | [models.BillingUpdateBillingMethod](../models/billing-update-billing-method.md) | :heavy_check_mark: | 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. | +| `maxPurchase` | *number* | :heavy_minus_sign: | Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-update-item.md b/packages/sdk/docs/models/billing-update-item.md index 66c0c5a91..68430ea1d 100644 --- a/packages/sdk/docs/models/billing-update-item.md +++ b/packages/sdk/docs/models/billing-update-item.md @@ -12,12 +12,12 @@ let value: BillingUpdateItem = { ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `included` | *number* | :heavy_minus_sign: | N/A | -| `unlimited` | *boolean* | :heavy_minus_sign: | N/A | -| `reset` | [models.BillingUpdateReset](../models/billing-update-reset.md) | :heavy_minus_sign: | N/A | -| `price` | [models.BillingUpdateItemPrice](../models/billing-update-item-price.md) | :heavy_minus_sign: | N/A | -| `proration` | [models.BillingUpdateProration](../models/billing-update-proration.md) | :heavy_minus_sign: | N/A | -| `rollover` | [models.BillingUpdateRollover](../models/billing-update-rollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature to configure. | +| `included` | *number* | :heavy_minus_sign: | Number of free units included. Balance resets to this each interval for consumable features. | +| `unlimited` | *boolean* | :heavy_minus_sign: | If true, customer has unlimited access to this feature. | +| `reset` | [models.BillingUpdateReset](../models/billing-update-reset.md) | :heavy_minus_sign: | Reset configuration for consumable features. Omit for non-consumable features like seats. | +| `price` | [models.BillingUpdateItemPrice](../models/billing-update-item-price.md) | :heavy_minus_sign: | Pricing for usage beyond included units. Omit for free features. | +| `proration` | [models.BillingUpdateProration](../models/billing-update-proration.md) | :heavy_minus_sign: | Proration settings for prepaid features. Controls mid-cycle quantity change billing. | +| `rollover` | [models.BillingUpdateRollover](../models/billing-update-rollover.md) | :heavy_minus_sign: | Rollover config for unused units. If set, unused included units carry over. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-update-on-decrease.md b/packages/sdk/docs/models/billing-update-on-decrease.md index e6cc3b9fb..e2ce12d32 100644 --- a/packages/sdk/docs/models/billing-update-on-decrease.md +++ b/packages/sdk/docs/models/billing-update-on-decrease.md @@ -1,5 +1,7 @@ # BillingUpdateOnDecrease +Credit behavior when quantity decreases mid-cycle. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-update-on-increase.md b/packages/sdk/docs/models/billing-update-on-increase.md index 8754e710d..873c3fb31 100644 --- a/packages/sdk/docs/models/billing-update-on-increase.md +++ b/packages/sdk/docs/models/billing-update-on-increase.md @@ -1,5 +1,7 @@ # BillingUpdateOnIncrease +Billing behavior when quantity increases mid-cycle. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-update-price-interval.md b/packages/sdk/docs/models/billing-update-price-interval.md index 9b44ee082..512381bc8 100644 --- a/packages/sdk/docs/models/billing-update-price-interval.md +++ b/packages/sdk/docs/models/billing-update-price-interval.md @@ -1,5 +1,7 @@ # BillingUpdatePriceInterval +Billing interval (e.g. 'month', 'year'). + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-update-price.md b/packages/sdk/docs/models/billing-update-price.md index 15952b398..899b4d5af 100644 --- a/packages/sdk/docs/models/billing-update-price.md +++ b/packages/sdk/docs/models/billing-update-price.md @@ -15,6 +15,6 @@ let value: BillingUpdatePrice = { | Field | Type | Required | Description | | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_check_mark: | N/A | -| `interval` | [models.BillingUpdatePriceInterval](../models/billing-update-price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `amount` | *number* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.BillingUpdatePriceInterval](../models/billing-update-price-interval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-update-proration.md b/packages/sdk/docs/models/billing-update-proration.md index d21ea7dde..36cdcc2b2 100644 --- a/packages/sdk/docs/models/billing-update-proration.md +++ b/packages/sdk/docs/models/billing-update-proration.md @@ -1,5 +1,7 @@ # BillingUpdateProration +Proration settings for prepaid features. Controls mid-cycle quantity change billing. + ## Example Usage ```typescript @@ -15,5 +17,5 @@ let value: BillingUpdateProration = { | Field | Type | Required | Description | | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `onIncrease` | [models.BillingUpdateOnIncrease](../models/billing-update-on-increase.md) | :heavy_check_mark: | N/A | -| `onDecrease` | [models.BillingUpdateOnDecrease](../models/billing-update-on-decrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| `onIncrease` | [models.BillingUpdateOnIncrease](../models/billing-update-on-increase.md) | :heavy_check_mark: | Billing behavior when quantity increases mid-cycle. | +| `onDecrease` | [models.BillingUpdateOnDecrease](../models/billing-update-on-decrease.md) | :heavy_check_mark: | Credit behavior when quantity decreases mid-cycle. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-update-reset-interval.md b/packages/sdk/docs/models/billing-update-reset-interval.md index 191bcacbf..11c3d5a21 100644 --- a/packages/sdk/docs/models/billing-update-reset-interval.md +++ b/packages/sdk/docs/models/billing-update-reset-interval.md @@ -1,5 +1,7 @@ # BillingUpdateResetInterval +Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-update-reset.md b/packages/sdk/docs/models/billing-update-reset.md index 74108db68..c30be84a9 100644 --- a/packages/sdk/docs/models/billing-update-reset.md +++ b/packages/sdk/docs/models/billing-update-reset.md @@ -1,5 +1,7 @@ # BillingUpdateReset +Reset configuration for consumable features. Omit for non-consumable features like seats. + ## Example Usage ```typescript @@ -12,7 +14,7 @@ let value: BillingUpdateReset = { ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `interval` | [models.BillingUpdateResetInterval](../models/billing-update-reset-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `interval` | [models.BillingUpdateResetInterval](../models/billing-update-reset-interval.md) | :heavy_check_mark: | Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-update-rollover.md b/packages/sdk/docs/models/billing-update-rollover.md index 7bcaef54f..495c3c6fa 100644 --- a/packages/sdk/docs/models/billing-update-rollover.md +++ b/packages/sdk/docs/models/billing-update-rollover.md @@ -1,5 +1,7 @@ # BillingUpdateRollover +Rollover config for unused units. If set, unused included units carry over. + ## Example Usage ```typescript @@ -14,6 +16,6 @@ let value: BillingUpdateRollover = { | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `max` | *number* | :heavy_minus_sign: | N/A | -| `expiryDurationType` | [models.BillingUpdateExpiryDurationType](../models/billing-update-expiry-duration-type.md) | :heavy_check_mark: | N/A | -| `expiryDurationLength` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `max` | *number* | :heavy_minus_sign: | Max rollover units. Omit for unlimited rollover. | +| `expiryDurationType` | [models.BillingUpdateExpiryDurationType](../models/billing-update-expiry-duration-type.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiryDurationLength` | *number* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/packages/sdk/docs/models/check-scenario.md b/packages/sdk/docs/models/check-scenario.md deleted file mode 100644 index 3d89a3dd6..000000000 --- a/packages/sdk/docs/models/check-scenario.md +++ /dev/null @@ -1,19 +0,0 @@ -# CheckScenario - -The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. - -## Example Usage - -```typescript -import { CheckScenario } from "@useautumn/sdk"; - -let value: CheckScenario = "usage_limit"; -``` - -## Values - -This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. - -```typescript -"usage_limit" | "feature_flag" | Unrecognized -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-billing-method-request.md b/packages/sdk/docs/models/create-plan-billing-method-request.md new file mode 100644 index 000000000..881afe679 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-billing-method-request.md @@ -0,0 +1,17 @@ +# CreatePlanBillingMethodRequest + +'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + +## Example Usage + +```typescript +import { CreatePlanBillingMethodRequest } from "@useautumn/sdk"; + +let value: CreatePlanBillingMethodRequest = "usage_based"; +``` + +## Values + +```typescript +"prepaid" | "usage_based" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-billing-method-response.md b/packages/sdk/docs/models/create-plan-billing-method-response.md new file mode 100644 index 000000000..c23b3e14c --- /dev/null +++ b/packages/sdk/docs/models/create-plan-billing-method-response.md @@ -0,0 +1,19 @@ +# CreatePlanBillingMethodResponse + +'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + +## Example Usage + +```typescript +import { CreatePlanBillingMethodResponse } from "@useautumn/sdk"; + +let value: CreatePlanBillingMethodResponse = "usage_based"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"prepaid" | "usage_based" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-credit-schema.md b/packages/sdk/docs/models/create-plan-credit-schema.md new file mode 100644 index 000000000..35385d13f --- /dev/null +++ b/packages/sdk/docs/models/create-plan-credit-schema.md @@ -0,0 +1,19 @@ +# CreatePlanCreditSchema + +## Example Usage + +```typescript +import { CreatePlanCreditSchema } from "@useautumn/sdk"; + +let value: CreatePlanCreditSchema = { + meteredFeatureId: "", + creditCost: 4035.58, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `meteredFeatureId` | *string* | :heavy_check_mark: | The ID of the metered feature (should be a single_use feature). | +| `creditCost` | *number* | :heavy_check_mark: | The credit cost of the metered feature. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-duration-type-request.md b/packages/sdk/docs/models/create-plan-duration-type-request.md new file mode 100644 index 000000000..61eda90ca --- /dev/null +++ b/packages/sdk/docs/models/create-plan-duration-type-request.md @@ -0,0 +1,17 @@ +# CreatePlanDurationTypeRequest + +Unit of time for the trial ('day', 'month', 'year'). + +## Example Usage + +```typescript +import { CreatePlanDurationTypeRequest } from "@useautumn/sdk"; + +let value: CreatePlanDurationTypeRequest = "month"; +``` + +## Values + +```typescript +"day" | "month" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-duration-type-response.md b/packages/sdk/docs/models/create-plan-duration-type-response.md new file mode 100644 index 000000000..77c170b36 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-duration-type-response.md @@ -0,0 +1,19 @@ +# CreatePlanDurationTypeResponse + +Unit of time for the trial duration ('day', 'month', 'year'). + +## Example Usage + +```typescript +import { CreatePlanDurationTypeResponse } from "@useautumn/sdk"; + +let value: CreatePlanDurationTypeResponse = "day"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"day" | "month" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-env.md b/packages/sdk/docs/models/create-plan-env.md new file mode 100644 index 000000000..54bc47b8d --- /dev/null +++ b/packages/sdk/docs/models/create-plan-env.md @@ -0,0 +1,19 @@ +# CreatePlanEnv + +Environment this plan belongs to ('sandbox' or 'live'). + +## Example Usage + +```typescript +import { CreatePlanEnv } from "@useautumn/sdk"; + +let value: CreatePlanEnv = "sandbox"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"sandbox" | "live" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-expiry-duration-type-request.md b/packages/sdk/docs/models/create-plan-expiry-duration-type-request.md new file mode 100644 index 000000000..e24e9550a --- /dev/null +++ b/packages/sdk/docs/models/create-plan-expiry-duration-type-request.md @@ -0,0 +1,17 @@ +# CreatePlanExpiryDurationTypeRequest + +When rolled over units expire. + +## Example Usage + +```typescript +import { CreatePlanExpiryDurationTypeRequest } from "@useautumn/sdk"; + +let value: CreatePlanExpiryDurationTypeRequest = "month"; +``` + +## Values + +```typescript +"month" | "forever" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-expiry-duration-type-response.md b/packages/sdk/docs/models/create-plan-expiry-duration-type-response.md new file mode 100644 index 000000000..0e763d963 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-expiry-duration-type-response.md @@ -0,0 +1,19 @@ +# CreatePlanExpiryDurationTypeResponse + +When rolled over units expire. + +## Example Usage + +```typescript +import { CreatePlanExpiryDurationTypeResponse } from "@useautumn/sdk"; + +let value: CreatePlanExpiryDurationTypeResponse = "forever"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"month" | "forever" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-feature-display.md b/packages/sdk/docs/models/create-plan-feature-display.md new file mode 100644 index 000000000..0fd38509c --- /dev/null +++ b/packages/sdk/docs/models/create-plan-feature-display.md @@ -0,0 +1,19 @@ +# CreatePlanFeatureDisplay + +## Example Usage + +```typescript +import { CreatePlanFeatureDisplay } from "@useautumn/sdk"; + +let value: CreatePlanFeatureDisplay = { + singular: "", + plural: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `singular` | *string* | :heavy_check_mark: | The singular display name for the feature. | +| `plural` | *string* | :heavy_check_mark: | The plural display name for the feature. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-feature.md b/packages/sdk/docs/models/create-plan-feature.md new file mode 100644 index 000000000..758f5a8c5 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-feature.md @@ -0,0 +1,25 @@ +# CreatePlanFeature + +The full feature object if expanded. + +## Example Usage + +```typescript +import { CreatePlanFeature } from "@useautumn/sdk"; + +let value: CreatePlanFeature = { + id: "", + type: "continuous_use", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `id` | *string* | :heavy_check_mark: | The ID of the feature, used to refer to it in other API calls like /track or /check. | +| `name` | *string* | :heavy_minus_sign: | The name of the feature. | +| `type` | [models.CreatePlanType](../models/create-plan-type.md) | :heavy_check_mark: | The type of the feature | +| `display` | [models.CreatePlanFeatureDisplay](../models/create-plan-feature-display.md) | :heavy_minus_sign: | Singular and plural display names for the feature. | +| `creditSchema` | [models.CreatePlanCreditSchema](../models/create-plan-credit-schema.md)[] | :heavy_minus_sign: | Credit cost schema for credit system features. | +| `archived` | *boolean* | :heavy_minus_sign: | Whether or not the feature is archived. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-free-trial-request.md b/packages/sdk/docs/models/create-plan-free-trial-request.md new file mode 100644 index 000000000..4424eab3a --- /dev/null +++ b/packages/sdk/docs/models/create-plan-free-trial-request.md @@ -0,0 +1,21 @@ +# CreatePlanFreeTrialRequest + +Free trial configuration. Customers can try this plan before being charged. + +## Example Usage + +```typescript +import { CreatePlanFreeTrialRequest } from "@useautumn/sdk"; + +let value: CreatePlanFreeTrialRequest = { + durationLength: 6103.01, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `durationLength` | *number* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `durationType` | [models.CreatePlanDurationTypeRequest](../models/create-plan-duration-type-request.md) | :heavy_minus_sign: | Unit of time for the trial ('day', 'month', 'year'). | +| `cardRequired` | *boolean* | :heavy_minus_sign: | If true, payment method required to start trial. Customer is charged after trial ends. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-free-trial-response.md b/packages/sdk/docs/models/create-plan-free-trial-response.md new file mode 100644 index 000000000..5e9e1c2c4 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-free-trial-response.md @@ -0,0 +1,23 @@ +# CreatePlanFreeTrialResponse + +Free trial configuration. If set, new customers can try this plan before being charged. + +## Example Usage + +```typescript +import { CreatePlanFreeTrialResponse } from "@useautumn/sdk"; + +let value: CreatePlanFreeTrialResponse = { + durationLength: 3045.72, + durationType: "year", + cardRequired: false, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `durationLength` | *number* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `durationType` | [models.CreatePlanDurationTypeResponse](../models/create-plan-duration-type-response.md) | :heavy_check_mark: | Unit of time for the trial duration ('day', 'month', 'year'). | +| `cardRequired` | *boolean* | :heavy_check_mark: | Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-globals.md b/packages/sdk/docs/models/create-plan-globals.md new file mode 100644 index 000000000..0a9b2c98b --- /dev/null +++ b/packages/sdk/docs/models/create-plan-globals.md @@ -0,0 +1,15 @@ +# CreatePlanGlobals + +## Example Usage + +```typescript +import { CreatePlanGlobals } from "@useautumn/sdk"; + +let value: CreatePlanGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-item-display.md b/packages/sdk/docs/models/create-plan-item-display.md new file mode 100644 index 000000000..85d51c73b --- /dev/null +++ b/packages/sdk/docs/models/create-plan-item-display.md @@ -0,0 +1,20 @@ +# CreatePlanItemDisplay + +Display text for showing this item in pricing pages. + +## Example Usage + +```typescript +import { CreatePlanItemDisplay } from "@useautumn/sdk"; + +let value: CreatePlanItemDisplay = { + primaryText: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primaryText` | *string* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondaryText` | *string* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-item-price-interval-request.md b/packages/sdk/docs/models/create-plan-item-price-interval-request.md new file mode 100644 index 000000000..e7e6a8e39 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-item-price-interval-request.md @@ -0,0 +1,17 @@ +# CreatePlanItemPriceIntervalRequest + +Billing interval. For consumable features, should match reset.interval. + +## Example Usage + +```typescript +import { CreatePlanItemPriceIntervalRequest } from "@useautumn/sdk"; + +let value: CreatePlanItemPriceIntervalRequest = "month"; +``` + +## Values + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-item-price-request.md b/packages/sdk/docs/models/create-plan-item-price-request.md new file mode 100644 index 000000000..9e9af3a94 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-item-price-request.md @@ -0,0 +1,26 @@ +# CreatePlanItemPriceRequest + +Pricing for usage beyond included units. Omit for free features. + +## Example Usage + +```typescript +import { CreatePlanItemPriceRequest } from "@useautumn/sdk"; + +let value: CreatePlanItemPriceRequest = { + interval: "year", + billingMethod: "prepaid", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `amount` | *number* | :heavy_minus_sign: | Price per billing_units after included usage. Either 'amount' or 'tiers' is required. | +| `tiers` | [models.CreatePlanTierRequest](../models/create-plan-tier-request.md)[] | :heavy_minus_sign: | Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. | +| `interval` | [models.CreatePlanItemPriceIntervalRequest](../models/create-plan-item-price-interval-request.md) | :heavy_check_mark: | Billing interval. For consumable features, should match reset.interval. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billingUnits` | *number* | :heavy_minus_sign: | Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). | +| `billingMethod` | [models.CreatePlanBillingMethodRequest](../models/create-plan-billing-method-request.md) | :heavy_check_mark: | 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. | +| `maxPurchase` | *number* | :heavy_minus_sign: | Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-item-price-response.md b/packages/sdk/docs/models/create-plan-item-price-response.md new file mode 100644 index 000000000..c4af69da8 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-item-price-response.md @@ -0,0 +1,26 @@ +# CreatePlanItemPriceResponse + +## Example Usage + +```typescript +import { CreatePlanItemPriceResponse } from "@useautumn/sdk"; + +let value: CreatePlanItemPriceResponse = { + interval: "semi_annual", + billingUnits: 5583.21, + billingMethod: "usage_based", + maxPurchase: 3653.33, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | Price per billing_units after included usage is consumed. Mutually exclusive with tiers. | +| `tiers` | [models.CreatePlanTierResponse](../models/create-plan-tier-response.md)[] | :heavy_minus_sign: | Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. | +| `interval` | [models.CreatePlanPriceItemIntervalResponse](../models/create-plan-price-item-interval-response.md) | :heavy_check_mark: | Billing interval for this price. For consumable features, should match reset.interval. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billingUnits` | *number* | :heavy_check_mark: | Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). | +| `billingMethod` | [models.CreatePlanBillingMethodResponse](../models/create-plan-billing-method-response.md) | :heavy_check_mark: | 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-item-request.md b/packages/sdk/docs/models/create-plan-item-request.md new file mode 100644 index 000000000..73930876a --- /dev/null +++ b/packages/sdk/docs/models/create-plan-item-request.md @@ -0,0 +1,23 @@ +# CreatePlanItemRequest + +## Example Usage + +```typescript +import { CreatePlanItemRequest } from "@useautumn/sdk"; + +let value: CreatePlanItemRequest = { + featureId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature to configure. | +| `included` | *number* | :heavy_minus_sign: | Number of free units included. Balance resets to this each interval for consumable features. | +| `unlimited` | *boolean* | :heavy_minus_sign: | If true, customer has unlimited access to this feature. | +| `reset` | [models.CreatePlanResetRequest](../models/create-plan-reset-request.md) | :heavy_minus_sign: | Reset configuration for consumable features. Omit for non-consumable features like seats. | +| `price` | [models.CreatePlanItemPriceRequest](../models/create-plan-item-price-request.md) | :heavy_minus_sign: | Pricing for usage beyond included units. Omit for free features. | +| `proration` | [models.CreatePlanProration](../models/create-plan-proration.md) | :heavy_minus_sign: | Proration settings for prepaid features. Controls mid-cycle quantity change billing. | +| `rollover` | [models.CreatePlanRolloverRequest](../models/create-plan-rollover-request.md) | :heavy_minus_sign: | Rollover config for unused units. If set, unused included units carry over. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-item-response.md b/packages/sdk/docs/models/create-plan-item-response.md new file mode 100644 index 000000000..7ece6d43f --- /dev/null +++ b/packages/sdk/docs/models/create-plan-item-response.md @@ -0,0 +1,35 @@ +# CreatePlanItemResponse + +## Example Usage + +```typescript +import { CreatePlanItemResponse } from "@useautumn/sdk"; + +let value: CreatePlanItemResponse = { + featureId: "", + included: 5028.41, + unlimited: false, + reset: { + interval: "day", + }, + price: { + interval: "one_off", + billingUnits: 1977.16, + billingMethod: "prepaid", + maxPurchase: 1825.29, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature this item configures. | +| `feature` | [models.CreatePlanFeature](../models/create-plan-feature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `included` | *number* | :heavy_check_mark: | Number of free units included. For consumable features, balance resets to this number each interval. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether the customer has unlimited access to this feature. | +| `reset` | [models.CreatePlanResetResponse](../models/create-plan-reset-response.md) | :heavy_check_mark: | Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. | +| `price` | [models.CreatePlanItemPriceResponse](../models/create-plan-item-price-response.md) | :heavy_check_mark: | Pricing configuration for usage beyond included units. Null if feature is entirely free. | +| `display` | [models.CreatePlanItemDisplay](../models/create-plan-item-display.md) | :heavy_minus_sign: | Display text for showing this item in pricing pages. | +| `rollover` | [models.CreatePlanRolloverResponse](../models/create-plan-rollover-response.md) | :heavy_minus_sign: | Rollover configuration for unused units. If set, unused included units roll over to the next period. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-on-decrease.md b/packages/sdk/docs/models/create-plan-on-decrease.md new file mode 100644 index 000000000..ed196ac39 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-on-decrease.md @@ -0,0 +1,17 @@ +# CreatePlanOnDecrease + +Credit behavior when quantity decreases mid-cycle. + +## Example Usage + +```typescript +import { CreatePlanOnDecrease } from "@useautumn/sdk"; + +let value: CreatePlanOnDecrease = "prorate_immediately"; +``` + +## Values + +```typescript +"prorate" | "prorate_immediately" | "prorate_next_cycle" | "none" | "no_prorations" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-on-increase.md b/packages/sdk/docs/models/create-plan-on-increase.md new file mode 100644 index 000000000..4636c8e7b --- /dev/null +++ b/packages/sdk/docs/models/create-plan-on-increase.md @@ -0,0 +1,17 @@ +# CreatePlanOnIncrease + +Billing behavior when quantity increases mid-cycle. + +## Example Usage + +```typescript +import { CreatePlanOnIncrease } from "@useautumn/sdk"; + +let value: CreatePlanOnIncrease = "bill_immediately"; +``` + +## Values + +```typescript +"bill_immediately" | "prorate_immediately" | "prorate_next_cycle" | "bill_next_cycle" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-params.md b/packages/sdk/docs/models/create-plan-params.md new file mode 100644 index 000000000..1ae5baa75 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-params.md @@ -0,0 +1,36 @@ +# CreatePlanParams + +## Example Usage + +```typescript +import { CreatePlanParams } from "@useautumn/sdk"; + +let value: CreatePlanParams = { + planId: "free_plan", + name: "Free", + autoEnable: true, + items: [ + { + featureId: "messages", + included: 100, + reset: { + interval: "month", + }, + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `planId` | *string* | :heavy_check_mark: | The ID of the plan to create. | +| `group` | *string* | :heavy_minus_sign: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `name` | *string* | :heavy_check_mark: | Display name of the plan. | +| `description` | *string* | :heavy_minus_sign: | Optional description of the plan. | +| `addOn` | *boolean* | :heavy_minus_sign: | If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. | +| `autoEnable` | *boolean* | :heavy_minus_sign: | If true, plan is automatically attached when a customer is created. Use for free tiers. | +| `price` | [models.CreatePlanPriceRequest](../models/create-plan-price-request.md) | :heavy_minus_sign: | Base recurring price for the plan. Omit for free or usage-only plans. | +| `items` | [models.CreatePlanItemRequest](../models/create-plan-item-request.md)[] | :heavy_minus_sign: | Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. | +| `freeTrial` | [models.CreatePlanFreeTrialRequest](../models/create-plan-free-trial-request.md) | :heavy_minus_sign: | Free trial configuration. Customers can try this plan before being charged. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-price-display.md b/packages/sdk/docs/models/create-plan-price-display.md new file mode 100644 index 000000000..d5cd57a4a --- /dev/null +++ b/packages/sdk/docs/models/create-plan-price-display.md @@ -0,0 +1,20 @@ +# CreatePlanPriceDisplay + +Display text for showing this price in pricing pages. + +## Example Usage + +```typescript +import { CreatePlanPriceDisplay } from "@useautumn/sdk"; + +let value: CreatePlanPriceDisplay = { + primaryText: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primaryText` | *string* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondaryText` | *string* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-price-interval-request.md b/packages/sdk/docs/models/create-plan-price-interval-request.md new file mode 100644 index 000000000..041e09cef --- /dev/null +++ b/packages/sdk/docs/models/create-plan-price-interval-request.md @@ -0,0 +1,17 @@ +# CreatePlanPriceIntervalRequest + +Billing interval (e.g. 'month', 'year'). + +## Example Usage + +```typescript +import { CreatePlanPriceIntervalRequest } from "@useautumn/sdk"; + +let value: CreatePlanPriceIntervalRequest = "month"; +``` + +## Values + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-price-interval-response.md b/packages/sdk/docs/models/create-plan-price-interval-response.md new file mode 100644 index 000000000..c11dea424 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-price-interval-response.md @@ -0,0 +1,19 @@ +# CreatePlanPriceIntervalResponse + +Billing interval (e.g. 'month', 'year'). + +## Example Usage + +```typescript +import { CreatePlanPriceIntervalResponse } from "@useautumn/sdk"; + +let value: CreatePlanPriceIntervalResponse = "month"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-price-item-interval-response.md b/packages/sdk/docs/models/create-plan-price-item-interval-response.md new file mode 100644 index 000000000..738eae0cc --- /dev/null +++ b/packages/sdk/docs/models/create-plan-price-item-interval-response.md @@ -0,0 +1,19 @@ +# CreatePlanPriceItemIntervalResponse + +Billing interval for this price. For consumable features, should match reset.interval. + +## Example Usage + +```typescript +import { CreatePlanPriceItemIntervalResponse } from "@useautumn/sdk"; + +let value: CreatePlanPriceItemIntervalResponse = "week"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-price-request.md b/packages/sdk/docs/models/create-plan-price-request.md new file mode 100644 index 000000000..3ce15921b --- /dev/null +++ b/packages/sdk/docs/models/create-plan-price-request.md @@ -0,0 +1,22 @@ +# CreatePlanPriceRequest + +Base recurring price for the plan. Omit for free or usage-only plans. + +## Example Usage + +```typescript +import { CreatePlanPriceRequest } from "@useautumn/sdk"; + +let value: CreatePlanPriceRequest = { + amount: 6009.59, + interval: "semi_annual", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.CreatePlanPriceIntervalRequest](../models/create-plan-price-interval-request.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-price-response.md b/packages/sdk/docs/models/create-plan-price-response.md new file mode 100644 index 000000000..e81f6f4c0 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-price-response.md @@ -0,0 +1,21 @@ +# CreatePlanPriceResponse + +## Example Usage + +```typescript +import { CreatePlanPriceResponse } from "@useautumn/sdk"; + +let value: CreatePlanPriceResponse = { + amount: 9771.73, + interval: "year", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `amount` | *number* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.CreatePlanPriceIntervalResponse](../models/create-plan-price-interval-response.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `display` | [models.CreatePlanPriceDisplay](../models/create-plan-price-display.md) | :heavy_minus_sign: | Display text for showing this price in pricing pages. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-proration.md b/packages/sdk/docs/models/create-plan-proration.md new file mode 100644 index 000000000..13bec7919 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-proration.md @@ -0,0 +1,21 @@ +# CreatePlanProration + +Proration settings for prepaid features. Controls mid-cycle quantity change billing. + +## Example Usage + +```typescript +import { CreatePlanProration } from "@useautumn/sdk"; + +let value: CreatePlanProration = { + onIncrease: "prorate_next_cycle", + onDecrease: "none", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `onIncrease` | [models.CreatePlanOnIncrease](../models/create-plan-on-increase.md) | :heavy_check_mark: | Billing behavior when quantity increases mid-cycle. | +| `onDecrease` | [models.CreatePlanOnDecrease](../models/create-plan-on-decrease.md) | :heavy_check_mark: | Credit behavior when quantity decreases mid-cycle. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-reset-interval-request.md b/packages/sdk/docs/models/create-plan-reset-interval-request.md new file mode 100644 index 000000000..3ab22b050 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-reset-interval-request.md @@ -0,0 +1,17 @@ +# CreatePlanResetIntervalRequest + +Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + +## Example Usage + +```typescript +import { CreatePlanResetIntervalRequest } from "@useautumn/sdk"; + +let value: CreatePlanResetIntervalRequest = "year"; +``` + +## Values + +```typescript +"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-reset-interval-response.md b/packages/sdk/docs/models/create-plan-reset-interval-response.md new file mode 100644 index 000000000..726d39c72 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-reset-interval-response.md @@ -0,0 +1,19 @@ +# CreatePlanResetIntervalResponse + +The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + +## Example Usage + +```typescript +import { CreatePlanResetIntervalResponse } from "@useautumn/sdk"; + +let value: CreatePlanResetIntervalResponse = "month"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-reset-request.md b/packages/sdk/docs/models/create-plan-reset-request.md new file mode 100644 index 000000000..4e26ac4ee --- /dev/null +++ b/packages/sdk/docs/models/create-plan-reset-request.md @@ -0,0 +1,20 @@ +# CreatePlanResetRequest + +Reset configuration for consumable features. Omit for non-consumable features like seats. + +## Example Usage + +```typescript +import { CreatePlanResetRequest } from "@useautumn/sdk"; + +let value: CreatePlanResetRequest = { + interval: "semi_annual", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `interval` | [models.CreatePlanResetIntervalRequest](../models/create-plan-reset-interval-request.md) | :heavy_check_mark: | Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-reset-response.md b/packages/sdk/docs/models/create-plan-reset-response.md new file mode 100644 index 000000000..f99bd3cdd --- /dev/null +++ b/packages/sdk/docs/models/create-plan-reset-response.md @@ -0,0 +1,18 @@ +# CreatePlanResetResponse + +## Example Usage + +```typescript +import { CreatePlanResetResponse } from "@useautumn/sdk"; + +let value: CreatePlanResetResponse = { + interval: "quarter", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `interval` | [models.CreatePlanResetIntervalResponse](../models/create-plan-reset-interval-response.md) | :heavy_check_mark: | The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-response.md b/packages/sdk/docs/models/create-plan-response.md new file mode 100644 index 000000000..b853cd66e --- /dev/null +++ b/packages/sdk/docs/models/create-plan-response.md @@ -0,0 +1,85 @@ +# CreatePlanResponse + +A plan defines a set of features, pricing, and entitlements that can be attached to customers. + +## Example Usage + +```typescript +import { CreatePlanResponse } from "@useautumn/sdk"; + +let value: CreatePlanResponse = { + id: "pro", + name: "Pro Plan", + description: null, + group: null, + version: 1, + addOn: false, + autoEnable: false, + price: { + amount: 10, + interval: "month", + display: { + primaryText: "", + }, + }, + items: [ + { + featureId: "", + included: 100, + unlimited: false, + reset: { + interval: "month", + }, + price: { + amount: 0.5, + interval: "month", + billingUnits: 9198.36, + billingMethod: "usage_based", + maxPurchase: 8417.02, + }, + display: { + primaryText: "", + }, + }, + { + featureId: "", + included: 0, + unlimited: false, + reset: null, + price: { + amount: 10, + interval: "month", + billingUnits: 872.48, + billingMethod: "prepaid", + maxPurchase: 6406.39, + }, + display: { + primaryText: "", + }, + }, + ], + createdAt: 5673.82, + env: "sandbox", + archived: false, + baseVariantId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | Unique identifier for the plan. | +| `name` | *string* | :heavy_check_mark: | Display name of the plan. | +| `description` | *string* | :heavy_check_mark: | Optional description of the plan. | +| `group` | *string* | :heavy_check_mark: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `version` | *number* | :heavy_check_mark: | Version number of the plan. Incremented when plan configuration changes. | +| `addOn` | *boolean* | :heavy_check_mark: | Whether this is an add-on plan that can be attached alongside a main plan. | +| `autoEnable` | *boolean* | :heavy_check_mark: | If true, this plan is automatically attached when a customer is created. Used for free plans. | +| `price` | [models.CreatePlanPriceResponse](../models/create-plan-price-response.md) | :heavy_check_mark: | Base recurring price for the plan. Null for free plans or usage-only plans. | +| `items` | [models.CreatePlanItemResponse](../models/create-plan-item-response.md)[] | :heavy_check_mark: | Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. | +| `freeTrial` | [models.CreatePlanFreeTrialResponse](../models/create-plan-free-trial-response.md) | :heavy_minus_sign: | Free trial configuration. If set, new customers can try this plan before being charged. | +| `createdAt` | *number* | :heavy_check_mark: | Unix timestamp (ms) when the plan was created. | +| `env` | [models.CreatePlanEnv](../models/create-plan-env.md) | :heavy_check_mark: | Environment this plan belongs to ('sandbox' or 'live'). | +| `archived` | *boolean* | :heavy_check_mark: | Whether the plan is archived. Archived plans cannot be attached to new customers. | +| `baseVariantId` | *string* | :heavy_check_mark: | If this is a variant, the ID of the base plan it was created from. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-rollover-request.md b/packages/sdk/docs/models/create-plan-rollover-request.md new file mode 100644 index 000000000..fda02ef4e --- /dev/null +++ b/packages/sdk/docs/models/create-plan-rollover-request.md @@ -0,0 +1,21 @@ +# CreatePlanRolloverRequest + +Rollover config for unused units. If set, unused included units carry over. + +## Example Usage + +```typescript +import { CreatePlanRolloverRequest } from "@useautumn/sdk"; + +let value: CreatePlanRolloverRequest = { + expiryDurationType: "month", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `max` | *number* | :heavy_minus_sign: | Max rollover units. Omit for unlimited rollover. | +| `expiryDurationType` | [models.CreatePlanExpiryDurationTypeRequest](../models/create-plan-expiry-duration-type-request.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiryDurationLength` | *number* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-rollover-response.md b/packages/sdk/docs/models/create-plan-rollover-response.md new file mode 100644 index 000000000..5333fae7f --- /dev/null +++ b/packages/sdk/docs/models/create-plan-rollover-response.md @@ -0,0 +1,22 @@ +# CreatePlanRolloverResponse + +Rollover configuration for unused units. If set, unused included units roll over to the next period. + +## Example Usage + +```typescript +import { CreatePlanRolloverResponse } from "@useautumn/sdk"; + +let value: CreatePlanRolloverResponse = { + max: 5790.26, + expiryDurationType: "forever", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `max` | *number* | :heavy_check_mark: | Maximum rollover units. Null for unlimited rollover. | +| `expiryDurationType` | [models.CreatePlanExpiryDurationTypeResponse](../models/create-plan-expiry-duration-type-response.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiryDurationLength` | *number* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-tier-request.md b/packages/sdk/docs/models/create-plan-tier-request.md new file mode 100644 index 000000000..1910aff51 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-tier-request.md @@ -0,0 +1,19 @@ +# CreatePlanTierRequest + +## Example Usage + +```typescript +import { CreatePlanTierRequest } from "@useautumn/sdk"; + +let value: CreatePlanTierRequest = { + to: "", + amount: 3075.43, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | +| `to` | *models.CreatePlanToRequest* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-tier-response.md b/packages/sdk/docs/models/create-plan-tier-response.md new file mode 100644 index 000000000..2f7579b43 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-tier-response.md @@ -0,0 +1,19 @@ +# CreatePlanTierResponse + +## Example Usage + +```typescript +import { CreatePlanTierResponse } from "@useautumn/sdk"; + +let value: CreatePlanTierResponse = { + to: "", + amount: 765.38, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- | +| `to` | *models.CreatePlanToResponse* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-plan-to-request.md b/packages/sdk/docs/models/create-plan-to-request.md new file mode 100644 index 000000000..cd93e6c51 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-to-request.md @@ -0,0 +1,17 @@ +# CreatePlanToRequest + + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/create-plan-to-response.md b/packages/sdk/docs/models/create-plan-to-response.md new file mode 100644 index 000000000..8f6cb3010 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-to-response.md @@ -0,0 +1,17 @@ +# CreatePlanToResponse + + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/create-plan-type.md b/packages/sdk/docs/models/create-plan-type.md new file mode 100644 index 000000000..6e9be0f14 --- /dev/null +++ b/packages/sdk/docs/models/create-plan-type.md @@ -0,0 +1,19 @@ +# CreatePlanType + +The type of the feature + +## Example Usage + +```typescript +import { CreatePlanType } from "@useautumn/sdk"; + +let value: CreatePlanType = "boolean"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"static" | "boolean" | "single_use" | "continuous_use" | "credit_system" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/customer-eligibility.md b/packages/sdk/docs/models/customer-eligibility.md deleted file mode 100644 index ca0c3e1ce..000000000 --- a/packages/sdk/docs/models/customer-eligibility.md +++ /dev/null @@ -1,18 +0,0 @@ -# CustomerEligibility - -## Example Usage - -```typescript -import { CustomerEligibility } from "@useautumn/sdk"; - -let value: CustomerEligibility = { - scenario: "upgrade", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| `trialAvailable` | *boolean* | :heavy_minus_sign: | N/A | -| `scenario` | [models.Scenario](../models/scenario.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/delete-plan-globals.md b/packages/sdk/docs/models/delete-plan-globals.md new file mode 100644 index 000000000..2858c93f8 --- /dev/null +++ b/packages/sdk/docs/models/delete-plan-globals.md @@ -0,0 +1,15 @@ +# DeletePlanGlobals + +## Example Usage + +```typescript +import { DeletePlanGlobals } from "@useautumn/sdk"; + +let value: DeletePlanGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/delete-plan-params.md b/packages/sdk/docs/models/delete-plan-params.md new file mode 100644 index 000000000..d29af20ce --- /dev/null +++ b/packages/sdk/docs/models/delete-plan-params.md @@ -0,0 +1,18 @@ +# DeletePlanParams + +## Example Usage + +```typescript +import { DeletePlanParams } from "@useautumn/sdk"; + +let value: DeletePlanParams = { + planId: "unused_plan", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `planId` | *string* | :heavy_check_mark: | The ID of the plan to delete. | +| `allVersions` | *boolean* | :heavy_minus_sign: | If true, deletes all versions of the plan. Otherwise, only deletes the latest version. | \ No newline at end of file diff --git a/packages/sdk/docs/models/delete-plan-response.md b/packages/sdk/docs/models/delete-plan-response.md new file mode 100644 index 000000000..279d06d99 --- /dev/null +++ b/packages/sdk/docs/models/delete-plan-response.md @@ -0,0 +1,19 @@ +# DeletePlanResponse + +OK + +## Example Usage + +```typescript +import { DeletePlanResponse } from "@useautumn/sdk"; + +let value: DeletePlanResponse = { + success: true, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `success` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/expiry-duration-type.md b/packages/sdk/docs/models/expiry-duration-type.md index 38df300d4..c622ff905 100644 --- a/packages/sdk/docs/models/expiry-duration-type.md +++ b/packages/sdk/docs/models/expiry-duration-type.md @@ -1,5 +1,7 @@ # ExpiryDurationType +When rolled over units expire. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/free-trial.md b/packages/sdk/docs/models/free-trial.md index 4600b15c1..f9f3e74e3 100644 --- a/packages/sdk/docs/models/free-trial.md +++ b/packages/sdk/docs/models/free-trial.md @@ -1,5 +1,7 @@ # FreeTrial +Free trial configuration. If set, new customers can try this plan before being charged. + ## Example Usage ```typescript @@ -14,8 +16,8 @@ let value: FreeTrial = { ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `durationLength` | *number* | :heavy_check_mark: | N/A | -| `durationType` | [models.PlanDurationType](../models/plan-duration-type.md) | :heavy_check_mark: | N/A | -| `cardRequired` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `durationLength` | *number* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `durationType` | [models.PlanDurationType](../models/plan-duration-type.md) | :heavy_check_mark: | Unit of time for the trial duration ('day', 'month', 'year'). | +| `cardRequired` | *boolean* | :heavy_check_mark: | Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-billing-method.md b/packages/sdk/docs/models/get-plan-billing-method.md new file mode 100644 index 000000000..f5768604c --- /dev/null +++ b/packages/sdk/docs/models/get-plan-billing-method.md @@ -0,0 +1,19 @@ +# GetPlanBillingMethod + +'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + +## Example Usage + +```typescript +import { GetPlanBillingMethod } from "@useautumn/sdk"; + +let value: GetPlanBillingMethod = "prepaid"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"prepaid" | "usage_based" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-credit-schema.md b/packages/sdk/docs/models/get-plan-credit-schema.md new file mode 100644 index 000000000..d0de73aba --- /dev/null +++ b/packages/sdk/docs/models/get-plan-credit-schema.md @@ -0,0 +1,19 @@ +# GetPlanCreditSchema + +## Example Usage + +```typescript +import { GetPlanCreditSchema } from "@useautumn/sdk"; + +let value: GetPlanCreditSchema = { + meteredFeatureId: "", + creditCost: 5581.71, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `meteredFeatureId` | *string* | :heavy_check_mark: | The ID of the metered feature (should be a single_use feature). | +| `creditCost` | *number* | :heavy_check_mark: | The credit cost of the metered feature. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-duration-type.md b/packages/sdk/docs/models/get-plan-duration-type.md new file mode 100644 index 000000000..08738e384 --- /dev/null +++ b/packages/sdk/docs/models/get-plan-duration-type.md @@ -0,0 +1,19 @@ +# GetPlanDurationType + +Unit of time for the trial duration ('day', 'month', 'year'). + +## Example Usage + +```typescript +import { GetPlanDurationType } from "@useautumn/sdk"; + +let value: GetPlanDurationType = "year"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"day" | "month" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-env.md b/packages/sdk/docs/models/get-plan-env.md new file mode 100644 index 000000000..502bfcc49 --- /dev/null +++ b/packages/sdk/docs/models/get-plan-env.md @@ -0,0 +1,19 @@ +# GetPlanEnv + +Environment this plan belongs to ('sandbox' or 'live'). + +## Example Usage + +```typescript +import { GetPlanEnv } from "@useautumn/sdk"; + +let value: GetPlanEnv = "sandbox"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"sandbox" | "live" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-expiry-duration-type.md b/packages/sdk/docs/models/get-plan-expiry-duration-type.md new file mode 100644 index 000000000..0b633db6c --- /dev/null +++ b/packages/sdk/docs/models/get-plan-expiry-duration-type.md @@ -0,0 +1,19 @@ +# GetPlanExpiryDurationType + +When rolled over units expire. + +## Example Usage + +```typescript +import { GetPlanExpiryDurationType } from "@useautumn/sdk"; + +let value: GetPlanExpiryDurationType = "month"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"month" | "forever" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-feature-display.md b/packages/sdk/docs/models/get-plan-feature-display.md new file mode 100644 index 000000000..8af89a517 --- /dev/null +++ b/packages/sdk/docs/models/get-plan-feature-display.md @@ -0,0 +1,19 @@ +# GetPlanFeatureDisplay + +## Example Usage + +```typescript +import { GetPlanFeatureDisplay } from "@useautumn/sdk"; + +let value: GetPlanFeatureDisplay = { + singular: "", + plural: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `singular` | *string* | :heavy_check_mark: | The singular display name for the feature. | +| `plural` | *string* | :heavy_check_mark: | The plural display name for the feature. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-feature.md b/packages/sdk/docs/models/get-plan-feature.md new file mode 100644 index 000000000..4635d872b --- /dev/null +++ b/packages/sdk/docs/models/get-plan-feature.md @@ -0,0 +1,25 @@ +# GetPlanFeature + +The full feature object if expanded. + +## Example Usage + +```typescript +import { GetPlanFeature } from "@useautumn/sdk"; + +let value: GetPlanFeature = { + id: "", + type: "boolean", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `id` | *string* | :heavy_check_mark: | The ID of the feature, used to refer to it in other API calls like /track or /check. | +| `name` | *string* | :heavy_minus_sign: | The name of the feature. | +| `type` | [models.GetPlanType](../models/get-plan-type.md) | :heavy_check_mark: | The type of the feature | +| `display` | [models.GetPlanFeatureDisplay](../models/get-plan-feature-display.md) | :heavy_minus_sign: | Singular and plural display names for the feature. | +| `creditSchema` | [models.GetPlanCreditSchema](../models/get-plan-credit-schema.md)[] | :heavy_minus_sign: | Credit cost schema for credit system features. | +| `archived` | *boolean* | :heavy_minus_sign: | Whether or not the feature is archived. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-free-trial.md b/packages/sdk/docs/models/get-plan-free-trial.md new file mode 100644 index 000000000..a50b8985f --- /dev/null +++ b/packages/sdk/docs/models/get-plan-free-trial.md @@ -0,0 +1,23 @@ +# GetPlanFreeTrial + +Free trial configuration. If set, new customers can try this plan before being charged. + +## Example Usage + +```typescript +import { GetPlanFreeTrial } from "@useautumn/sdk"; + +let value: GetPlanFreeTrial = { + durationLength: 7415.46, + durationType: "month", + cardRequired: false, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `durationLength` | *number* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `durationType` | [models.GetPlanDurationType](../models/get-plan-duration-type.md) | :heavy_check_mark: | Unit of time for the trial duration ('day', 'month', 'year'). | +| `cardRequired` | *boolean* | :heavy_check_mark: | Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-globals.md b/packages/sdk/docs/models/get-plan-globals.md new file mode 100644 index 000000000..4f5fa47ba --- /dev/null +++ b/packages/sdk/docs/models/get-plan-globals.md @@ -0,0 +1,15 @@ +# GetPlanGlobals + +## Example Usage + +```typescript +import { GetPlanGlobals } from "@useautumn/sdk"; + +let value: GetPlanGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-item-display.md b/packages/sdk/docs/models/get-plan-item-display.md new file mode 100644 index 000000000..1e3256b21 --- /dev/null +++ b/packages/sdk/docs/models/get-plan-item-display.md @@ -0,0 +1,20 @@ +# GetPlanItemDisplay + +Display text for showing this item in pricing pages. + +## Example Usage + +```typescript +import { GetPlanItemDisplay } from "@useautumn/sdk"; + +let value: GetPlanItemDisplay = { + primaryText: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primaryText` | *string* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondaryText` | *string* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-item-price.md b/packages/sdk/docs/models/get-plan-item-price.md new file mode 100644 index 000000000..812fbaf6f --- /dev/null +++ b/packages/sdk/docs/models/get-plan-item-price.md @@ -0,0 +1,26 @@ +# GetPlanItemPrice + +## Example Usage + +```typescript +import { GetPlanItemPrice } from "@useautumn/sdk"; + +let value: GetPlanItemPrice = { + interval: "quarter", + billingUnits: 4527.53, + billingMethod: "prepaid", + maxPurchase: 9972.04, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | Price per billing_units after included usage is consumed. Mutually exclusive with tiers. | +| `tiers` | [models.GetPlanTier](../models/get-plan-tier.md)[] | :heavy_minus_sign: | Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. | +| `interval` | [models.GetPlanPriceItemInterval](../models/get-plan-price-item-interval.md) | :heavy_check_mark: | Billing interval for this price. For consumable features, should match reset.interval. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billingUnits` | *number* | :heavy_check_mark: | Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). | +| `billingMethod` | [models.GetPlanBillingMethod](../models/get-plan-billing-method.md) | :heavy_check_mark: | 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-item.md b/packages/sdk/docs/models/get-plan-item.md new file mode 100644 index 000000000..d11f0c5ca --- /dev/null +++ b/packages/sdk/docs/models/get-plan-item.md @@ -0,0 +1,33 @@ +# GetPlanItem + +## Example Usage + +```typescript +import { GetPlanItem } from "@useautumn/sdk"; + +let value: GetPlanItem = { + featureId: "", + included: 7379.05, + unlimited: true, + reset: null, + price: { + interval: "week", + billingUnits: 9438.14, + billingMethod: "prepaid", + maxPurchase: 4224.48, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature this item configures. | +| `feature` | [models.GetPlanFeature](../models/get-plan-feature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `included` | *number* | :heavy_check_mark: | Number of free units included. For consumable features, balance resets to this number each interval. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether the customer has unlimited access to this feature. | +| `reset` | [models.GetPlanReset](../models/get-plan-reset.md) | :heavy_check_mark: | Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. | +| `price` | [models.GetPlanItemPrice](../models/get-plan-item-price.md) | :heavy_check_mark: | Pricing configuration for usage beyond included units. Null if feature is entirely free. | +| `display` | [models.GetPlanItemDisplay](../models/get-plan-item-display.md) | :heavy_minus_sign: | Display text for showing this item in pricing pages. | +| `rollover` | [models.GetPlanRollover](../models/get-plan-rollover.md) | :heavy_minus_sign: | Rollover configuration for unused units. If set, unused included units roll over to the next period. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-params.md b/packages/sdk/docs/models/get-plan-params.md new file mode 100644 index 000000000..9b24cbd37 --- /dev/null +++ b/packages/sdk/docs/models/get-plan-params.md @@ -0,0 +1,18 @@ +# GetPlanParams + +## Example Usage + +```typescript +import { GetPlanParams } from "@useautumn/sdk"; + +let value: GetPlanParams = { + planId: "pro_plan", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `planId` | *string* | :heavy_check_mark: | The ID of the plan to retrieve. | +| `version` | *number* | :heavy_minus_sign: | The version of the plan to get. Defaults to the latest version. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-price-display.md b/packages/sdk/docs/models/get-plan-price-display.md new file mode 100644 index 000000000..a385e4971 --- /dev/null +++ b/packages/sdk/docs/models/get-plan-price-display.md @@ -0,0 +1,20 @@ +# GetPlanPriceDisplay + +Display text for showing this price in pricing pages. + +## Example Usage + +```typescript +import { GetPlanPriceDisplay } from "@useautumn/sdk"; + +let value: GetPlanPriceDisplay = { + primaryText: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primaryText` | *string* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondaryText` | *string* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-price-interval.md b/packages/sdk/docs/models/get-plan-price-interval.md new file mode 100644 index 000000000..63a258d28 --- /dev/null +++ b/packages/sdk/docs/models/get-plan-price-interval.md @@ -0,0 +1,19 @@ +# GetPlanPriceInterval + +Billing interval (e.g. 'month', 'year'). + +## Example Usage + +```typescript +import { GetPlanPriceInterval } from "@useautumn/sdk"; + +let value: GetPlanPriceInterval = "one_off"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-price-item-interval.md b/packages/sdk/docs/models/get-plan-price-item-interval.md new file mode 100644 index 000000000..af0c14090 --- /dev/null +++ b/packages/sdk/docs/models/get-plan-price-item-interval.md @@ -0,0 +1,19 @@ +# GetPlanPriceItemInterval + +Billing interval for this price. For consumable features, should match reset.interval. + +## Example Usage + +```typescript +import { GetPlanPriceItemInterval } from "@useautumn/sdk"; + +let value: GetPlanPriceItemInterval = "month"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-price.md b/packages/sdk/docs/models/get-plan-price.md new file mode 100644 index 000000000..8cfac5aa0 --- /dev/null +++ b/packages/sdk/docs/models/get-plan-price.md @@ -0,0 +1,21 @@ +# GetPlanPrice + +## Example Usage + +```typescript +import { GetPlanPrice } from "@useautumn/sdk"; + +let value: GetPlanPrice = { + amount: 8428, + interval: "semi_annual", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `amount` | *number* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.GetPlanPriceInterval](../models/get-plan-price-interval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `display` | [models.GetPlanPriceDisplay](../models/get-plan-price-display.md) | :heavy_minus_sign: | Display text for showing this price in pricing pages. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-reset-interval.md b/packages/sdk/docs/models/get-plan-reset-interval.md new file mode 100644 index 000000000..56d62f31d --- /dev/null +++ b/packages/sdk/docs/models/get-plan-reset-interval.md @@ -0,0 +1,19 @@ +# GetPlanResetInterval + +The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + +## Example Usage + +```typescript +import { GetPlanResetInterval } from "@useautumn/sdk"; + +let value: GetPlanResetInterval = "semi_annual"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-reset.md b/packages/sdk/docs/models/get-plan-reset.md new file mode 100644 index 000000000..77c041736 --- /dev/null +++ b/packages/sdk/docs/models/get-plan-reset.md @@ -0,0 +1,18 @@ +# GetPlanReset + +## Example Usage + +```typescript +import { GetPlanReset } from "@useautumn/sdk"; + +let value: GetPlanReset = { + interval: "week", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `interval` | [models.GetPlanResetInterval](../models/get-plan-reset-interval.md) | :heavy_check_mark: | The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-response.md b/packages/sdk/docs/models/get-plan-response.md new file mode 100644 index 000000000..570023d52 --- /dev/null +++ b/packages/sdk/docs/models/get-plan-response.md @@ -0,0 +1,85 @@ +# GetPlanResponse + +A plan defines a set of features, pricing, and entitlements that can be attached to customers. + +## Example Usage + +```typescript +import { GetPlanResponse } from "@useautumn/sdk"; + +let value: GetPlanResponse = { + id: "pro", + name: "Pro Plan", + description: null, + group: null, + version: 1, + addOn: false, + autoEnable: false, + price: { + amount: 10, + interval: "month", + display: { + primaryText: "", + }, + }, + items: [ + { + featureId: "", + included: 100, + unlimited: false, + reset: { + interval: "month", + }, + price: { + amount: 0.5, + interval: "month", + billingUnits: 5868.2, + billingMethod: "prepaid", + maxPurchase: 2187.59, + }, + display: { + primaryText: "", + }, + }, + { + featureId: "", + included: 0, + unlimited: false, + reset: null, + price: { + amount: 10, + interval: "month", + billingUnits: 9307.08, + billingMethod: "prepaid", + maxPurchase: 4756.72, + }, + display: { + primaryText: "", + }, + }, + ], + createdAt: 9495.6, + env: "sandbox", + archived: false, + baseVariantId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | Unique identifier for the plan. | +| `name` | *string* | :heavy_check_mark: | Display name of the plan. | +| `description` | *string* | :heavy_check_mark: | Optional description of the plan. | +| `group` | *string* | :heavy_check_mark: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `version` | *number* | :heavy_check_mark: | Version number of the plan. Incremented when plan configuration changes. | +| `addOn` | *boolean* | :heavy_check_mark: | Whether this is an add-on plan that can be attached alongside a main plan. | +| `autoEnable` | *boolean* | :heavy_check_mark: | If true, this plan is automatically attached when a customer is created. Used for free plans. | +| `price` | [models.GetPlanPrice](../models/get-plan-price.md) | :heavy_check_mark: | Base recurring price for the plan. Null for free plans or usage-only plans. | +| `items` | [models.GetPlanItem](../models/get-plan-item.md)[] | :heavy_check_mark: | Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. | +| `freeTrial` | [models.GetPlanFreeTrial](../models/get-plan-free-trial.md) | :heavy_minus_sign: | Free trial configuration. If set, new customers can try this plan before being charged. | +| `createdAt` | *number* | :heavy_check_mark: | Unix timestamp (ms) when the plan was created. | +| `env` | [models.GetPlanEnv](../models/get-plan-env.md) | :heavy_check_mark: | Environment this plan belongs to ('sandbox' or 'live'). | +| `archived` | *boolean* | :heavy_check_mark: | Whether the plan is archived. Archived plans cannot be attached to new customers. | +| `baseVariantId` | *string* | :heavy_check_mark: | If this is a variant, the ID of the base plan it was created from. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-rollover.md b/packages/sdk/docs/models/get-plan-rollover.md new file mode 100644 index 000000000..2ed20d9be --- /dev/null +++ b/packages/sdk/docs/models/get-plan-rollover.md @@ -0,0 +1,22 @@ +# GetPlanRollover + +Rollover configuration for unused units. If set, unused included units roll over to the next period. + +## Example Usage + +```typescript +import { GetPlanRollover } from "@useautumn/sdk"; + +let value: GetPlanRollover = { + max: 9820.59, + expiryDurationType: "month", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `max` | *number* | :heavy_check_mark: | Maximum rollover units. Null for unlimited rollover. | +| `expiryDurationType` | [models.GetPlanExpiryDurationType](../models/get-plan-expiry-duration-type.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiryDurationLength` | *number* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/packages/sdk/docs/models/price-display.md b/packages/sdk/docs/models/get-plan-tier.md similarity index 51% rename from packages/sdk/docs/models/price-display.md rename to packages/sdk/docs/models/get-plan-tier.md index 9fd571821..1577a0166 100644 --- a/packages/sdk/docs/models/price-display.md +++ b/packages/sdk/docs/models/get-plan-tier.md @@ -1,12 +1,13 @@ -# PriceDisplay +# GetPlanTier ## Example Usage ```typescript -import { PriceDisplay } from "@useautumn/sdk"; +import { GetPlanTier } from "@useautumn/sdk"; -let value: PriceDisplay = { - primaryText: "", +let value: GetPlanTier = { + to: 5653.58, + amount: 8449.52, }; ``` @@ -14,5 +15,5 @@ let value: PriceDisplay = { | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `primaryText` | *string* | :heavy_check_mark: | N/A | -| `secondaryText` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `to` | *models.GetPlanTo* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-plan-to.md b/packages/sdk/docs/models/get-plan-to.md new file mode 100644 index 000000000..dd7f0b905 --- /dev/null +++ b/packages/sdk/docs/models/get-plan-to.md @@ -0,0 +1,17 @@ +# GetPlanTo + + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/get-plan-type.md b/packages/sdk/docs/models/get-plan-type.md new file mode 100644 index 000000000..75cd05fc9 --- /dev/null +++ b/packages/sdk/docs/models/get-plan-type.md @@ -0,0 +1,19 @@ +# GetPlanType + +The type of the feature + +## Example Usage + +```typescript +import { GetPlanType } from "@useautumn/sdk"; + +let value: GetPlanType = "boolean"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"static" | "boolean" | "single_use" | "continuous_use" | "credit_system" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/item.md b/packages/sdk/docs/models/item.md index ed47413df..c090aed3f 100644 --- a/packages/sdk/docs/models/item.md +++ b/packages/sdk/docs/models/item.md @@ -23,14 +23,13 @@ let value: Item = { ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `feature` | [models.PlanFeature](../models/plan-feature.md) | :heavy_minus_sign: | N/A | -| `included` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `reset` | [models.PlanReset](../models/plan-reset.md) | :heavy_check_mark: | N/A | -| `price` | [models.PlanItemPrice](../models/plan-item-price.md) | :heavy_check_mark: | N/A | -| `display` | [models.PlanItemDisplay](../models/plan-item-display.md) | :heavy_minus_sign: | N/A | -| `rollover` | [models.PlanRollover](../models/plan-rollover.md) | :heavy_minus_sign: | N/A | -| `proration` | [models.Proration](../models/proration.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature this item configures. | +| `feature` | [models.PlanFeature](../models/plan-feature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `included` | *number* | :heavy_check_mark: | Number of free units included. For consumable features, balance resets to this number each interval. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether the customer has unlimited access to this feature. | +| `reset` | [models.PlanReset](../models/plan-reset.md) | :heavy_check_mark: | Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. | +| `price` | [models.PlanItemPrice](../models/plan-item-price.md) | :heavy_check_mark: | Pricing configuration for usage beyond included units. Null if feature is entirely free. | +| `display` | [models.PlanItemDisplay](../models/plan-item-display.md) | :heavy_minus_sign: | Display text for showing this item in pricing pages. | +| `rollover` | [models.PlanRollover](../models/plan-rollover.md) | :heavy_minus_sign: | Rollover configuration for unused units. If set, unused included units roll over to the next period. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-billing-method.md b/packages/sdk/docs/models/list-plans-billing-method.md new file mode 100644 index 000000000..faaec3e26 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-billing-method.md @@ -0,0 +1,19 @@ +# ListPlansBillingMethod + +'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + +## Example Usage + +```typescript +import { ListPlansBillingMethod } from "@useautumn/sdk"; + +let value: ListPlansBillingMethod = "usage_based"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"prepaid" | "usage_based" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-credit-schema.md b/packages/sdk/docs/models/list-plans-credit-schema.md new file mode 100644 index 000000000..2e6e429f6 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-credit-schema.md @@ -0,0 +1,19 @@ +# ListPlansCreditSchema + +## Example Usage + +```typescript +import { ListPlansCreditSchema } from "@useautumn/sdk"; + +let value: ListPlansCreditSchema = { + meteredFeatureId: "", + creditCost: 7196.78, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `meteredFeatureId` | *string* | :heavy_check_mark: | The ID of the metered feature (should be a single_use feature). | +| `creditCost` | *number* | :heavy_check_mark: | The credit cost of the metered feature. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-duration-type.md b/packages/sdk/docs/models/list-plans-duration-type.md new file mode 100644 index 000000000..24872dad4 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-duration-type.md @@ -0,0 +1,19 @@ +# ListPlansDurationType + +Unit of time for the trial duration ('day', 'month', 'year'). + +## Example Usage + +```typescript +import { ListPlansDurationType } from "@useautumn/sdk"; + +let value: ListPlansDurationType = "day"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"day" | "month" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-env.md b/packages/sdk/docs/models/list-plans-env.md new file mode 100644 index 000000000..b96f9cd95 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-env.md @@ -0,0 +1,19 @@ +# ListPlansEnv + +Environment this plan belongs to ('sandbox' or 'live'). + +## Example Usage + +```typescript +import { ListPlansEnv } from "@useautumn/sdk"; + +let value: ListPlansEnv = "live"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"sandbox" | "live" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-expiry-duration-type.md b/packages/sdk/docs/models/list-plans-expiry-duration-type.md new file mode 100644 index 000000000..4844fa2ea --- /dev/null +++ b/packages/sdk/docs/models/list-plans-expiry-duration-type.md @@ -0,0 +1,19 @@ +# ListPlansExpiryDurationType + +When rolled over units expire. + +## Example Usage + +```typescript +import { ListPlansExpiryDurationType } from "@useautumn/sdk"; + +let value: ListPlansExpiryDurationType = "forever"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"month" | "forever" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-feature-display.md b/packages/sdk/docs/models/list-plans-feature-display.md new file mode 100644 index 000000000..e80bf3060 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-feature-display.md @@ -0,0 +1,19 @@ +# ListPlansFeatureDisplay + +## Example Usage + +```typescript +import { ListPlansFeatureDisplay } from "@useautumn/sdk"; + +let value: ListPlansFeatureDisplay = { + singular: "", + plural: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `singular` | *string* | :heavy_check_mark: | The singular display name for the feature. | +| `plural` | *string* | :heavy_check_mark: | The plural display name for the feature. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-feature.md b/packages/sdk/docs/models/list-plans-feature.md new file mode 100644 index 000000000..9607cbb75 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-feature.md @@ -0,0 +1,25 @@ +# ListPlansFeature + +The full feature object if expanded. + +## Example Usage + +```typescript +import { ListPlansFeature } from "@useautumn/sdk"; + +let value: ListPlansFeature = { + id: "", + type: "single_use", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `id` | *string* | :heavy_check_mark: | The ID of the feature, used to refer to it in other API calls like /track or /check. | +| `name` | *string* | :heavy_minus_sign: | The name of the feature. | +| `type` | [models.ListPlansType](../models/list-plans-type.md) | :heavy_check_mark: | The type of the feature | +| `display` | [models.ListPlansFeatureDisplay](../models/list-plans-feature-display.md) | :heavy_minus_sign: | Singular and plural display names for the feature. | +| `creditSchema` | [models.ListPlansCreditSchema](../models/list-plans-credit-schema.md)[] | :heavy_minus_sign: | Credit cost schema for credit system features. | +| `archived` | *boolean* | :heavy_minus_sign: | Whether or not the feature is archived. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-free-trial.md b/packages/sdk/docs/models/list-plans-free-trial.md new file mode 100644 index 000000000..cf68bcfcf --- /dev/null +++ b/packages/sdk/docs/models/list-plans-free-trial.md @@ -0,0 +1,23 @@ +# ListPlansFreeTrial + +Free trial configuration. If set, new customers can try this plan before being charged. + +## Example Usage + +```typescript +import { ListPlansFreeTrial } from "@useautumn/sdk"; + +let value: ListPlansFreeTrial = { + durationLength: 5432.56, + durationType: "month", + cardRequired: true, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `durationLength` | *number* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `durationType` | [models.ListPlansDurationType](../models/list-plans-duration-type.md) | :heavy_check_mark: | Unit of time for the trial duration ('day', 'month', 'year'). | +| `cardRequired` | *boolean* | :heavy_check_mark: | Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-item-display.md b/packages/sdk/docs/models/list-plans-item-display.md new file mode 100644 index 000000000..534ae703c --- /dev/null +++ b/packages/sdk/docs/models/list-plans-item-display.md @@ -0,0 +1,20 @@ +# ListPlansItemDisplay + +Display text for showing this item in pricing pages. + +## Example Usage + +```typescript +import { ListPlansItemDisplay } from "@useautumn/sdk"; + +let value: ListPlansItemDisplay = { + primaryText: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primaryText` | *string* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondaryText` | *string* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-item-price.md b/packages/sdk/docs/models/list-plans-item-price.md new file mode 100644 index 000000000..1bd6eaf00 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-item-price.md @@ -0,0 +1,26 @@ +# ListPlansItemPrice + +## Example Usage + +```typescript +import { ListPlansItemPrice } from "@useautumn/sdk"; + +let value: ListPlansItemPrice = { + interval: "month", + billingUnits: 6146.33, + billingMethod: "prepaid", + maxPurchase: 1150.09, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | Price per billing_units after included usage is consumed. Mutually exclusive with tiers. | +| `tiers` | [models.ListPlansTier](../models/list-plans-tier.md)[] | :heavy_minus_sign: | Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. | +| `interval` | [models.ListPlansPriceItemInterval](../models/list-plans-price-item-interval.md) | :heavy_check_mark: | Billing interval for this price. For consumable features, should match reset.interval. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billingUnits` | *number* | :heavy_check_mark: | Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). | +| `billingMethod` | [models.ListPlansBillingMethod](../models/list-plans-billing-method.md) | :heavy_check_mark: | 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-item.md b/packages/sdk/docs/models/list-plans-item.md new file mode 100644 index 000000000..378d7d1cb --- /dev/null +++ b/packages/sdk/docs/models/list-plans-item.md @@ -0,0 +1,35 @@ +# ListPlansItem + +## Example Usage + +```typescript +import { ListPlansItem } from "@useautumn/sdk"; + +let value: ListPlansItem = { + featureId: "", + included: 4278.62, + unlimited: true, + reset: { + interval: "quarter", + }, + price: { + interval: "semi_annual", + billingUnits: 7496.01, + billingMethod: "prepaid", + maxPurchase: 2313.05, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature this item configures. | +| `feature` | [models.ListPlansFeature](../models/list-plans-feature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `included` | *number* | :heavy_check_mark: | Number of free units included. For consumable features, balance resets to this number each interval. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether the customer has unlimited access to this feature. | +| `reset` | [models.ListPlansReset](../models/list-plans-reset.md) | :heavy_check_mark: | Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. | +| `price` | [models.ListPlansItemPrice](../models/list-plans-item-price.md) | :heavy_check_mark: | Pricing configuration for usage beyond included units. Null if feature is entirely free. | +| `display` | [models.ListPlansItemDisplay](../models/list-plans-item-display.md) | :heavy_minus_sign: | Display text for showing this item in pricing pages. | +| `rollover` | [models.ListPlansRollover](../models/list-plans-rollover.md) | :heavy_minus_sign: | Rollover configuration for unused units. If set, unused included units roll over to the next period. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-list.md b/packages/sdk/docs/models/list-plans-list.md new file mode 100644 index 000000000..8337193bf --- /dev/null +++ b/packages/sdk/docs/models/list-plans-list.md @@ -0,0 +1,63 @@ +# ListPlansList + +A plan defines a set of features, pricing, and entitlements that can be attached to customers. + +## Example Usage + +```typescript +import { ListPlansList } from "@useautumn/sdk"; + +let value: ListPlansList = { + id: "", + name: "", + description: + "following zesty mainstream old-fashioned phooey grandiose misspend until um except", + group: "", + version: 5269.38, + addOn: false, + autoEnable: true, + price: { + amount: 6067.23, + interval: "quarter", + }, + items: [ + { + featureId: "", + included: 4783.11, + unlimited: false, + reset: { + interval: "quarter", + }, + price: { + interval: "semi_annual", + billingUnits: 7496.01, + billingMethod: "prepaid", + maxPurchase: 2313.05, + }, + }, + ], + createdAt: 3560.6, + env: "live", + archived: false, + baseVariantId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | Unique identifier for the plan. | +| `name` | *string* | :heavy_check_mark: | Display name of the plan. | +| `description` | *string* | :heavy_check_mark: | Optional description of the plan. | +| `group` | *string* | :heavy_check_mark: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `version` | *number* | :heavy_check_mark: | Version number of the plan. Incremented when plan configuration changes. | +| `addOn` | *boolean* | :heavy_check_mark: | Whether this is an add-on plan that can be attached alongside a main plan. | +| `autoEnable` | *boolean* | :heavy_check_mark: | If true, this plan is automatically attached when a customer is created. Used for free plans. | +| `price` | [models.ListPlansPrice](../models/list-plans-price.md) | :heavy_check_mark: | Base recurring price for the plan. Null for free plans or usage-only plans. | +| `items` | [models.ListPlansItem](../models/list-plans-item.md)[] | :heavy_check_mark: | Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. | +| `freeTrial` | [models.ListPlansFreeTrial](../models/list-plans-free-trial.md) | :heavy_minus_sign: | Free trial configuration. If set, new customers can try this plan before being charged. | +| `createdAt` | *number* | :heavy_check_mark: | Unix timestamp (ms) when the plan was created. | +| `env` | [models.ListPlansEnv](../models/list-plans-env.md) | :heavy_check_mark: | Environment this plan belongs to ('sandbox' or 'live'). | +| `archived` | *boolean* | :heavy_check_mark: | Whether the plan is archived. Archived plans cannot be attached to new customers. | +| `baseVariantId` | *string* | :heavy_check_mark: | If this is a variant, the ID of the base plan it was created from. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-params.md b/packages/sdk/docs/models/list-plans-params.md new file mode 100644 index 000000000..c77558ea7 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-params.md @@ -0,0 +1,17 @@ +# ListPlansParams + +## Example Usage + +```typescript +import { ListPlansParams } from "@useautumn/sdk"; + +let value: ListPlansParams = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `customerId` | *string* | :heavy_minus_sign: | Customer ID to include eligibility info (trial availability, attach scenario). | +| `entityId` | *string* | :heavy_minus_sign: | Entity ID for entity-scoped plans. | +| `includeArchived` | *boolean* | :heavy_minus_sign: | If true, includes archived plans in the response. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-price-display.md b/packages/sdk/docs/models/list-plans-price-display.md new file mode 100644 index 000000000..151bd7cef --- /dev/null +++ b/packages/sdk/docs/models/list-plans-price-display.md @@ -0,0 +1,20 @@ +# ListPlansPriceDisplay + +Display text for showing this price in pricing pages. + +## Example Usage + +```typescript +import { ListPlansPriceDisplay } from "@useautumn/sdk"; + +let value: ListPlansPriceDisplay = { + primaryText: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primaryText` | *string* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondaryText` | *string* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-price-interval.md b/packages/sdk/docs/models/list-plans-price-interval.md new file mode 100644 index 000000000..30ff6e6a9 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-price-interval.md @@ -0,0 +1,19 @@ +# ListPlansPriceInterval + +Billing interval (e.g. 'month', 'year'). + +## Example Usage + +```typescript +import { ListPlansPriceInterval } from "@useautumn/sdk"; + +let value: ListPlansPriceInterval = "one_off"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-price-item-interval.md b/packages/sdk/docs/models/list-plans-price-item-interval.md new file mode 100644 index 000000000..b6fb74fa2 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-price-item-interval.md @@ -0,0 +1,19 @@ +# ListPlansPriceItemInterval + +Billing interval for this price. For consumable features, should match reset.interval. + +## Example Usage + +```typescript +import { ListPlansPriceItemInterval } from "@useautumn/sdk"; + +let value: ListPlansPriceItemInterval = "quarter"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-price.md b/packages/sdk/docs/models/list-plans-price.md new file mode 100644 index 000000000..221e8ac6b --- /dev/null +++ b/packages/sdk/docs/models/list-plans-price.md @@ -0,0 +1,21 @@ +# ListPlansPrice + +## Example Usage + +```typescript +import { ListPlansPrice } from "@useautumn/sdk"; + +let value: ListPlansPrice = { + amount: 2279.84, + interval: "year", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `amount` | *number* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.ListPlansPriceInterval](../models/list-plans-price-interval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `display` | [models.ListPlansPriceDisplay](../models/list-plans-price-display.md) | :heavy_minus_sign: | Display text for showing this price in pricing pages. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-request.md b/packages/sdk/docs/models/list-plans-request.md deleted file mode 100644 index ed128a61b..000000000 --- a/packages/sdk/docs/models/list-plans-request.md +++ /dev/null @@ -1,17 +0,0 @@ -# ListPlansRequest - -## Example Usage - -```typescript -import { ListPlansRequest } from "@useautumn/sdk"; - -let value: ListPlansRequest = {}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `customerId` | *string* | :heavy_minus_sign: | N/A | -| `entityId` | *string* | :heavy_minus_sign: | N/A | -| `includeArchived` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-reset-interval.md b/packages/sdk/docs/models/list-plans-reset-interval.md new file mode 100644 index 000000000..c6b71b112 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-reset-interval.md @@ -0,0 +1,19 @@ +# ListPlansResetInterval + +The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + +## Example Usage + +```typescript +import { ListPlansResetInterval } from "@useautumn/sdk"; + +let value: ListPlansResetInterval = "year"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-reset.md b/packages/sdk/docs/models/list-plans-reset.md new file mode 100644 index 000000000..1f6ac3785 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-reset.md @@ -0,0 +1,18 @@ +# ListPlansReset + +## Example Usage + +```typescript +import { ListPlansReset } from "@useautumn/sdk"; + +let value: ListPlansReset = { + interval: "semi_annual", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `interval` | [models.ListPlansResetInterval](../models/list-plans-reset-interval.md) | :heavy_check_mark: | The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-response.md b/packages/sdk/docs/models/list-plans-response.md index 69b048bed..55a7c5e5e 100644 --- a/packages/sdk/docs/models/list-plans-response.md +++ b/packages/sdk/docs/models/list-plans-response.md @@ -8,12 +8,69 @@ OK import { ListPlansResponse } from "@useautumn/sdk"; let value: ListPlansResponse = { - list: [], + list: [ + { + id: "pro", + name: "Pro Plan", + description: null, + group: null, + version: 1, + addOn: true, + autoEnable: true, + price: { + amount: 10, + interval: "month", + display: { + primaryText: "", + }, + }, + items: [ + { + featureId: "", + included: 100, + unlimited: false, + reset: { + interval: "month", + }, + price: { + amount: 0.5, + interval: "month", + billingUnits: 6959.08, + billingMethod: "prepaid", + maxPurchase: null, + }, + display: { + primaryText: "", + }, + }, + { + featureId: "", + included: 0, + unlimited: false, + reset: null, + price: { + amount: 10, + interval: "month", + billingUnits: 2384.07, + billingMethod: "prepaid", + maxPurchase: 2561.91, + }, + display: { + primaryText: "", + }, + }, + ], + createdAt: 9164.93, + env: "sandbox", + archived: false, + baseVariantId: "", + }, + ], }; ``` ## Fields -| Field | Type | Required | Description | -| ---------------------------------- | ---------------------------------- | ---------------------------------- | ---------------------------------- | -| `list` | [models.Plan](../models/plan.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| `list` | [models.ListPlansList](../models/list-plans-list.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-rollover.md b/packages/sdk/docs/models/list-plans-rollover.md new file mode 100644 index 000000000..760b01c55 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-rollover.md @@ -0,0 +1,22 @@ +# ListPlansRollover + +Rollover configuration for unused units. If set, unused included units roll over to the next period. + +## Example Usage + +```typescript +import { ListPlansRollover } from "@useautumn/sdk"; + +let value: ListPlansRollover = { + max: 829.86, + expiryDurationType: "month", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `max` | *number* | :heavy_check_mark: | Maximum rollover units. Null for unlimited rollover. | +| `expiryDurationType` | [models.ListPlansExpiryDurationType](../models/list-plans-expiry-duration-type.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiryDurationLength` | *number* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-tier.md b/packages/sdk/docs/models/list-plans-tier.md new file mode 100644 index 000000000..04a868be6 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-tier.md @@ -0,0 +1,19 @@ +# ListPlansTier + +## Example Usage + +```typescript +import { ListPlansTier } from "@useautumn/sdk"; + +let value: ListPlansTier = { + to: "", + amount: 1413.03, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------- | -------------------- | -------------------- | -------------------- | +| `to` | *models.ListPlansTo* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-plans-to.md b/packages/sdk/docs/models/list-plans-to.md new file mode 100644 index 000000000..e8c79419f --- /dev/null +++ b/packages/sdk/docs/models/list-plans-to.md @@ -0,0 +1,17 @@ +# ListPlansTo + + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/list-plans-type.md b/packages/sdk/docs/models/list-plans-type.md new file mode 100644 index 000000000..4ea81aa95 --- /dev/null +++ b/packages/sdk/docs/models/list-plans-type.md @@ -0,0 +1,19 @@ +# ListPlansType + +The type of the feature + +## Example Usage + +```typescript +import { ListPlansType } from "@useautumn/sdk"; + +let value: ListPlansType = "boolean"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"static" | "boolean" | "single_use" | "continuous_use" | "credit_system" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/on-decrease.md b/packages/sdk/docs/models/on-decrease.md deleted file mode 100644 index 9fa821f88..000000000 --- a/packages/sdk/docs/models/on-decrease.md +++ /dev/null @@ -1,17 +0,0 @@ -# OnDecrease - -## Example Usage - -```typescript -import { OnDecrease } from "@useautumn/sdk"; - -let value: OnDecrease = "none"; -``` - -## Values - -This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. - -```typescript -"prorate" | "prorate_immediately" | "prorate_next_cycle" | "none" | "no_prorations" | Unrecognized -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/on-increase.md b/packages/sdk/docs/models/on-increase.md deleted file mode 100644 index 93010d453..000000000 --- a/packages/sdk/docs/models/on-increase.md +++ /dev/null @@ -1,17 +0,0 @@ -# OnIncrease - -## Example Usage - -```typescript -import { OnIncrease } from "@useautumn/sdk"; - -let value: OnIncrease = "bill_immediately"; -``` - -## Values - -This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. - -```typescript -"bill_immediately" | "prorate_immediately" | "prorate_next_cycle" | "bill_next_cycle" | Unrecognized -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/plan-billing-method.md b/packages/sdk/docs/models/plan-billing-method.md index 930e05fe3..6a3e64020 100644 --- a/packages/sdk/docs/models/plan-billing-method.md +++ b/packages/sdk/docs/models/plan-billing-method.md @@ -1,5 +1,7 @@ # PlanBillingMethod +'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/plan-duration-type.md b/packages/sdk/docs/models/plan-duration-type.md index f555765f6..5ca43e037 100644 --- a/packages/sdk/docs/models/plan-duration-type.md +++ b/packages/sdk/docs/models/plan-duration-type.md @@ -1,5 +1,7 @@ # PlanDurationType +Unit of time for the trial duration ('day', 'month', 'year'). + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/plan-env.md b/packages/sdk/docs/models/plan-env.md index 73febb8eb..c373f26a0 100644 --- a/packages/sdk/docs/models/plan-env.md +++ b/packages/sdk/docs/models/plan-env.md @@ -1,5 +1,7 @@ # PlanEnv +Environment this plan belongs to ('sandbox' or 'live'). + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/plan-feature.md b/packages/sdk/docs/models/plan-feature.md index 1fdccbb59..caf95f50d 100644 --- a/packages/sdk/docs/models/plan-feature.md +++ b/packages/sdk/docs/models/plan-feature.md @@ -1,5 +1,7 @@ # PlanFeature +The full feature object if expanded. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/plan-item-display.md b/packages/sdk/docs/models/plan-item-display.md index decdbe96b..7b445ddbf 100644 --- a/packages/sdk/docs/models/plan-item-display.md +++ b/packages/sdk/docs/models/plan-item-display.md @@ -1,5 +1,7 @@ # PlanItemDisplay +Display text for showing this item in pricing pages. + ## Example Usage ```typescript @@ -12,7 +14,7 @@ let value: PlanItemDisplay = { ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `primaryText` | *string* | :heavy_check_mark: | N/A | -| `secondaryText` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primaryText` | *string* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondaryText` | *string* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/packages/sdk/docs/models/plan-item-price.md b/packages/sdk/docs/models/plan-item-price.md index 849a03b44..76428e62a 100644 --- a/packages/sdk/docs/models/plan-item-price.md +++ b/packages/sdk/docs/models/plan-item-price.md @@ -15,12 +15,12 @@ let value: PlanItemPrice = { ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.PlanTier](../models/plan-tier.md)[] | :heavy_minus_sign: | N/A | -| `interval` | [models.PlanPriceItemInterval](../models/plan-price-item-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_check_mark: | N/A | -| `billingMethod` | [models.PlanBillingMethod](../models/plan-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | Price per billing_units after included usage is consumed. Mutually exclusive with tiers. | +| `tiers` | [models.PlanTier](../models/plan-tier.md)[] | :heavy_minus_sign: | Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. | +| `interval` | [models.PlanPriceItemInterval](../models/plan-price-item-interval.md) | :heavy_check_mark: | Billing interval for this price. For consumable features, should match reset.interval. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billingUnits` | *number* | :heavy_check_mark: | Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). | +| `billingMethod` | [models.PlanBillingMethod](../models/plan-billing-method.md) | :heavy_check_mark: | 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. | \ No newline at end of file diff --git a/packages/sdk/docs/models/plan-price-display.md b/packages/sdk/docs/models/plan-price-display.md new file mode 100644 index 000000000..61d0d0140 --- /dev/null +++ b/packages/sdk/docs/models/plan-price-display.md @@ -0,0 +1,20 @@ +# PlanPriceDisplay + +Display text for showing this price in pricing pages. + +## Example Usage + +```typescript +import { PlanPriceDisplay } from "@useautumn/sdk"; + +let value: PlanPriceDisplay = { + primaryText: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primaryText` | *string* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondaryText` | *string* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/packages/sdk/docs/models/plan-price-interval.md b/packages/sdk/docs/models/plan-price-interval.md index cf74878b0..ce8ac898f 100644 --- a/packages/sdk/docs/models/plan-price-interval.md +++ b/packages/sdk/docs/models/plan-price-interval.md @@ -1,5 +1,7 @@ # PlanPriceInterval +Billing interval (e.g. 'month', 'year'). + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/plan-price-item-interval.md b/packages/sdk/docs/models/plan-price-item-interval.md index 8a29c3ec3..630586b26 100644 --- a/packages/sdk/docs/models/plan-price-item-interval.md +++ b/packages/sdk/docs/models/plan-price-item-interval.md @@ -1,5 +1,7 @@ # PlanPriceItemInterval +Billing interval for this price. For consumable features, should match reset.interval. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/plan-price.md b/packages/sdk/docs/models/plan-price.md index 99883968d..6a5f8089f 100644 --- a/packages/sdk/docs/models/plan-price.md +++ b/packages/sdk/docs/models/plan-price.md @@ -15,7 +15,7 @@ let value: PlanPrice = { | Field | Type | Required | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `amount` | *number* | :heavy_check_mark: | N/A | -| `interval` | [models.PlanPriceInterval](../models/plan-price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `display` | [models.PriceDisplay](../models/price-display.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `amount` | *number* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.PlanPriceInterval](../models/plan-price-interval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `display` | [models.PlanPriceDisplay](../models/plan-price-display.md) | :heavy_minus_sign: | Display text for showing this price in pricing pages. | \ No newline at end of file diff --git a/packages/sdk/docs/models/plan-reset-interval.md b/packages/sdk/docs/models/plan-reset-interval.md index cdfc9bb8b..5b8b97ba7 100644 --- a/packages/sdk/docs/models/plan-reset-interval.md +++ b/packages/sdk/docs/models/plan-reset-interval.md @@ -1,5 +1,7 @@ # PlanResetInterval +The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/plan-reset.md b/packages/sdk/docs/models/plan-reset.md index 867574292..18a09bdae 100644 --- a/packages/sdk/docs/models/plan-reset.md +++ b/packages/sdk/docs/models/plan-reset.md @@ -12,7 +12,7 @@ let value: PlanReset = { ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `interval` | [models.PlanResetInterval](../models/plan-reset-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `interval` | [models.PlanResetInterval](../models/plan-reset-interval.md) | :heavy_check_mark: | The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/plan-rollover.md b/packages/sdk/docs/models/plan-rollover.md index 42ba84e2e..ce6551a61 100644 --- a/packages/sdk/docs/models/plan-rollover.md +++ b/packages/sdk/docs/models/plan-rollover.md @@ -1,5 +1,7 @@ # PlanRollover +Rollover configuration for unused units. If set, unused included units roll over to the next period. + ## Example Usage ```typescript @@ -15,6 +17,6 @@ let value: PlanRollover = { | Field | Type | Required | Description | | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `max` | *number* | :heavy_check_mark: | N/A | -| `expiryDurationType` | [models.ExpiryDurationType](../models/expiry-duration-type.md) | :heavy_check_mark: | N/A | -| `expiryDurationLength` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `max` | *number* | :heavy_check_mark: | Maximum rollover units. Null for unlimited rollover. | +| `expiryDurationType` | [models.ExpiryDurationType](../models/expiry-duration-type.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiryDurationLength` | *number* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/packages/sdk/docs/models/plan.md b/packages/sdk/docs/models/plan.md index c02b9a57f..4b2e0aaf4 100644 --- a/packages/sdk/docs/models/plan.md +++ b/packages/sdk/docs/models/plan.md @@ -28,20 +28,19 @@ let value: Plan = { ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | -| `id` | *string* | :heavy_check_mark: | N/A | -| `name` | *string* | :heavy_check_mark: | N/A | -| `description` | *string* | :heavy_check_mark: | N/A | -| `group` | *string* | :heavy_check_mark: | N/A | -| `version` | *number* | :heavy_check_mark: | N/A | -| `addOn` | *boolean* | :heavy_check_mark: | N/A | -| `autoEnable` | *boolean* | :heavy_check_mark: | N/A | -| `price` | [models.PlanPrice](../models/plan-price.md) | :heavy_check_mark: | N/A | -| `items` | [models.Item](../models/item.md)[] | :heavy_check_mark: | N/A | -| `freeTrial` | [models.FreeTrial](../models/free-trial.md) | :heavy_minus_sign: | N/A | -| `createdAt` | *number* | :heavy_check_mark: | N/A | -| `env` | [models.PlanEnv](../models/plan-env.md) | :heavy_check_mark: | N/A | -| `archived` | *boolean* | :heavy_check_mark: | N/A | -| `baseVariantId` | *string* | :heavy_check_mark: | N/A | -| `customerEligibility` | [models.CustomerEligibility](../models/customer-eligibility.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | Unique identifier for the plan. | +| `name` | *string* | :heavy_check_mark: | Display name of the plan. | +| `description` | *string* | :heavy_check_mark: | Optional description of the plan. | +| `group` | *string* | :heavy_check_mark: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `version` | *number* | :heavy_check_mark: | Version number of the plan. Incremented when plan configuration changes. | +| `addOn` | *boolean* | :heavy_check_mark: | Whether this is an add-on plan that can be attached alongside a main plan. | +| `autoEnable` | *boolean* | :heavy_check_mark: | If true, this plan is automatically attached when a customer is created. Used for free plans. | +| `price` | [models.PlanPrice](../models/plan-price.md) | :heavy_check_mark: | Base recurring price for the plan. Null for free plans or usage-only plans. | +| `items` | [models.Item](../models/item.md)[] | :heavy_check_mark: | Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. | +| `freeTrial` | [models.FreeTrial](../models/free-trial.md) | :heavy_minus_sign: | Free trial configuration. If set, new customers can try this plan before being charged. | +| `createdAt` | *number* | :heavy_check_mark: | Unix timestamp (ms) when the plan was created. | +| `env` | [models.PlanEnv](../models/plan-env.md) | :heavy_check_mark: | Environment this plan belongs to ('sandbox' or 'live'). | +| `archived` | *boolean* | :heavy_check_mark: | Whether the plan is archived. Archived plans cannot be attached to new customers. | +| `baseVariantId` | *string* | :heavy_check_mark: | If this is a variant, the ID of the base plan it was created from. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-billing-method.md b/packages/sdk/docs/models/preview-attach-billing-method.md index 7d5384ae1..2994990f3 100644 --- a/packages/sdk/docs/models/preview-attach-billing-method.md +++ b/packages/sdk/docs/models/preview-attach-billing-method.md @@ -1,5 +1,7 @@ # PreviewAttachBillingMethod +'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-attach-duration-type.md b/packages/sdk/docs/models/preview-attach-duration-type.md index c42259efc..ce4bbb878 100644 --- a/packages/sdk/docs/models/preview-attach-duration-type.md +++ b/packages/sdk/docs/models/preview-attach-duration-type.md @@ -1,5 +1,7 @@ # PreviewAttachDurationType +Unit of time for the trial ('day', 'month', 'year'). + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-attach-expiry-duration-type.md b/packages/sdk/docs/models/preview-attach-expiry-duration-type.md index 9cfd61ebc..7c9a122f8 100644 --- a/packages/sdk/docs/models/preview-attach-expiry-duration-type.md +++ b/packages/sdk/docs/models/preview-attach-expiry-duration-type.md @@ -1,5 +1,7 @@ # PreviewAttachExpiryDurationType +When rolled over units expire. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-attach-free-trial.md b/packages/sdk/docs/models/preview-attach-free-trial.md index b65e3dcb3..955420850 100644 --- a/packages/sdk/docs/models/preview-attach-free-trial.md +++ b/packages/sdk/docs/models/preview-attach-free-trial.md @@ -12,8 +12,8 @@ let value: PreviewAttachFreeTrial = { ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `durationLength` | *number* | :heavy_check_mark: | N/A | -| `durationType` | [models.PreviewAttachDurationType](../models/preview-attach-duration-type.md) | :heavy_minus_sign: | N/A | -| `cardRequired` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `durationLength` | *number* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `durationType` | [models.PreviewAttachDurationType](../models/preview-attach-duration-type.md) | :heavy_minus_sign: | Unit of time for the trial ('day', 'month', 'year'). | +| `cardRequired` | *boolean* | :heavy_minus_sign: | If true, payment method required to start trial. Customer is charged after trial ends. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-item-price-interval.md b/packages/sdk/docs/models/preview-attach-item-price-interval.md index 26c8b425d..4d66328a8 100644 --- a/packages/sdk/docs/models/preview-attach-item-price-interval.md +++ b/packages/sdk/docs/models/preview-attach-item-price-interval.md @@ -1,5 +1,7 @@ # PreviewAttachItemPriceInterval +Billing interval. For consumable features, should match reset.interval. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-attach-item-price.md b/packages/sdk/docs/models/preview-attach-item-price.md index 204288b95..e73f9fdac 100644 --- a/packages/sdk/docs/models/preview-attach-item-price.md +++ b/packages/sdk/docs/models/preview-attach-item-price.md @@ -1,5 +1,7 @@ # PreviewAttachItemPrice +Pricing for usage beyond included units. Omit for free features. + ## Example Usage ```typescript @@ -13,12 +15,12 @@ let value: PreviewAttachItemPrice = { ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.PreviewAttachTier](../models/preview-attach-tier.md)[] | :heavy_minus_sign: | N/A | -| `interval` | [models.PreviewAttachItemPriceInterval](../models/preview-attach-item-price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_minus_sign: | N/A | -| `billingMethod` | [models.PreviewAttachBillingMethod](../models/preview-attach-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `amount` | *number* | :heavy_minus_sign: | Price per billing_units after included usage. Either 'amount' or 'tiers' is required. | +| `tiers` | [models.PreviewAttachTier](../models/preview-attach-tier.md)[] | :heavy_minus_sign: | Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. | +| `interval` | [models.PreviewAttachItemPriceInterval](../models/preview-attach-item-price-interval.md) | :heavy_check_mark: | Billing interval. For consumable features, should match reset.interval. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billingUnits` | *number* | :heavy_minus_sign: | Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). | +| `billingMethod` | [models.PreviewAttachBillingMethod](../models/preview-attach-billing-method.md) | :heavy_check_mark: | 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. | +| `maxPurchase` | *number* | :heavy_minus_sign: | Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-item.md b/packages/sdk/docs/models/preview-attach-item.md index 58d3071e9..73dbafc8b 100644 --- a/packages/sdk/docs/models/preview-attach-item.md +++ b/packages/sdk/docs/models/preview-attach-item.md @@ -12,12 +12,12 @@ let value: PreviewAttachItem = { ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `included` | *number* | :heavy_minus_sign: | N/A | -| `unlimited` | *boolean* | :heavy_minus_sign: | N/A | -| `reset` | [models.PreviewAttachReset](../models/preview-attach-reset.md) | :heavy_minus_sign: | N/A | -| `price` | [models.PreviewAttachItemPrice](../models/preview-attach-item-price.md) | :heavy_minus_sign: | N/A | -| `proration` | [models.PreviewAttachProration](../models/preview-attach-proration.md) | :heavy_minus_sign: | N/A | -| `rollover` | [models.PreviewAttachRollover](../models/preview-attach-rollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature to configure. | +| `included` | *number* | :heavy_minus_sign: | Number of free units included. Balance resets to this each interval for consumable features. | +| `unlimited` | *boolean* | :heavy_minus_sign: | If true, customer has unlimited access to this feature. | +| `reset` | [models.PreviewAttachReset](../models/preview-attach-reset.md) | :heavy_minus_sign: | Reset configuration for consumable features. Omit for non-consumable features like seats. | +| `price` | [models.PreviewAttachItemPrice](../models/preview-attach-item-price.md) | :heavy_minus_sign: | Pricing for usage beyond included units. Omit for free features. | +| `proration` | [models.PreviewAttachProration](../models/preview-attach-proration.md) | :heavy_minus_sign: | Proration settings for prepaid features. Controls mid-cycle quantity change billing. | +| `rollover` | [models.PreviewAttachRollover](../models/preview-attach-rollover.md) | :heavy_minus_sign: | Rollover config for unused units. If set, unused included units carry over. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-on-decrease.md b/packages/sdk/docs/models/preview-attach-on-decrease.md index 7990abab7..c9d69889a 100644 --- a/packages/sdk/docs/models/preview-attach-on-decrease.md +++ b/packages/sdk/docs/models/preview-attach-on-decrease.md @@ -1,5 +1,7 @@ # PreviewAttachOnDecrease +Credit behavior when quantity decreases mid-cycle. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-attach-on-increase.md b/packages/sdk/docs/models/preview-attach-on-increase.md index f12893d76..cc361cec6 100644 --- a/packages/sdk/docs/models/preview-attach-on-increase.md +++ b/packages/sdk/docs/models/preview-attach-on-increase.md @@ -1,5 +1,7 @@ # PreviewAttachOnIncrease +Billing behavior when quantity increases mid-cycle. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-attach-price-interval.md b/packages/sdk/docs/models/preview-attach-price-interval.md index ec12dc9c2..58e279131 100644 --- a/packages/sdk/docs/models/preview-attach-price-interval.md +++ b/packages/sdk/docs/models/preview-attach-price-interval.md @@ -1,5 +1,7 @@ # PreviewAttachPriceInterval +Billing interval (e.g. 'month', 'year'). + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-attach-price.md b/packages/sdk/docs/models/preview-attach-price.md index fd9c14771..300a02234 100644 --- a/packages/sdk/docs/models/preview-attach-price.md +++ b/packages/sdk/docs/models/preview-attach-price.md @@ -15,6 +15,6 @@ let value: PreviewAttachPrice = { | Field | Type | Required | Description | | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_check_mark: | N/A | -| `interval` | [models.PreviewAttachPriceInterval](../models/preview-attach-price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `amount` | *number* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.PreviewAttachPriceInterval](../models/preview-attach-price-interval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-proration.md b/packages/sdk/docs/models/preview-attach-proration.md index 0a47b28d0..8492b2b37 100644 --- a/packages/sdk/docs/models/preview-attach-proration.md +++ b/packages/sdk/docs/models/preview-attach-proration.md @@ -1,5 +1,7 @@ # PreviewAttachProration +Proration settings for prepaid features. Controls mid-cycle quantity change billing. + ## Example Usage ```typescript @@ -15,5 +17,5 @@ let value: PreviewAttachProration = { | Field | Type | Required | Description | | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `onIncrease` | [models.PreviewAttachOnIncrease](../models/preview-attach-on-increase.md) | :heavy_check_mark: | N/A | -| `onDecrease` | [models.PreviewAttachOnDecrease](../models/preview-attach-on-decrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| `onIncrease` | [models.PreviewAttachOnIncrease](../models/preview-attach-on-increase.md) | :heavy_check_mark: | Billing behavior when quantity increases mid-cycle. | +| `onDecrease` | [models.PreviewAttachOnDecrease](../models/preview-attach-on-decrease.md) | :heavy_check_mark: | Credit behavior when quantity decreases mid-cycle. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-reset-interval.md b/packages/sdk/docs/models/preview-attach-reset-interval.md index 45a0f9186..bf6fb2360 100644 --- a/packages/sdk/docs/models/preview-attach-reset-interval.md +++ b/packages/sdk/docs/models/preview-attach-reset-interval.md @@ -1,5 +1,7 @@ # PreviewAttachResetInterval +Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-attach-reset.md b/packages/sdk/docs/models/preview-attach-reset.md index 25dcc11c8..38738348c 100644 --- a/packages/sdk/docs/models/preview-attach-reset.md +++ b/packages/sdk/docs/models/preview-attach-reset.md @@ -1,5 +1,7 @@ # PreviewAttachReset +Reset configuration for consumable features. Omit for non-consumable features like seats. + ## Example Usage ```typescript @@ -12,7 +14,7 @@ let value: PreviewAttachReset = { ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `interval` | [models.PreviewAttachResetInterval](../models/preview-attach-reset-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `interval` | [models.PreviewAttachResetInterval](../models/preview-attach-reset-interval.md) | :heavy_check_mark: | Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-rollover.md b/packages/sdk/docs/models/preview-attach-rollover.md index 61746c7f9..5c6b64e3b 100644 --- a/packages/sdk/docs/models/preview-attach-rollover.md +++ b/packages/sdk/docs/models/preview-attach-rollover.md @@ -1,5 +1,7 @@ # PreviewAttachRollover +Rollover config for unused units. If set, unused included units carry over. + ## Example Usage ```typescript @@ -14,6 +16,6 @@ let value: PreviewAttachRollover = { | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `max` | *number* | :heavy_minus_sign: | N/A | -| `expiryDurationType` | [models.PreviewAttachExpiryDurationType](../models/preview-attach-expiry-duration-type.md) | :heavy_check_mark: | N/A | -| `expiryDurationLength` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `max` | *number* | :heavy_minus_sign: | Max rollover units. Omit for unlimited rollover. | +| `expiryDurationType` | [models.PreviewAttachExpiryDurationType](../models/preview-attach-expiry-duration-type.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiryDurationLength` | *number* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-billing-method.md b/packages/sdk/docs/models/preview-update-billing-method.md index 7e312adfb..78837cab4 100644 --- a/packages/sdk/docs/models/preview-update-billing-method.md +++ b/packages/sdk/docs/models/preview-update-billing-method.md @@ -1,5 +1,7 @@ # PreviewUpdateBillingMethod +'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-update-duration-type.md b/packages/sdk/docs/models/preview-update-duration-type.md index 8e7a60015..5e1dafc29 100644 --- a/packages/sdk/docs/models/preview-update-duration-type.md +++ b/packages/sdk/docs/models/preview-update-duration-type.md @@ -1,5 +1,7 @@ # PreviewUpdateDurationType +Unit of time for the trial ('day', 'month', 'year'). + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-update-expiry-duration-type.md b/packages/sdk/docs/models/preview-update-expiry-duration-type.md index 1f2e38a00..afde0074e 100644 --- a/packages/sdk/docs/models/preview-update-expiry-duration-type.md +++ b/packages/sdk/docs/models/preview-update-expiry-duration-type.md @@ -1,5 +1,7 @@ # PreviewUpdateExpiryDurationType +When rolled over units expire. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-update-free-trial.md b/packages/sdk/docs/models/preview-update-free-trial.md index c17094121..a26676fe2 100644 --- a/packages/sdk/docs/models/preview-update-free-trial.md +++ b/packages/sdk/docs/models/preview-update-free-trial.md @@ -12,8 +12,8 @@ let value: PreviewUpdateFreeTrial = { ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `durationLength` | *number* | :heavy_check_mark: | N/A | -| `durationType` | [models.PreviewUpdateDurationType](../models/preview-update-duration-type.md) | :heavy_minus_sign: | N/A | -| `cardRequired` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `durationLength` | *number* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `durationType` | [models.PreviewUpdateDurationType](../models/preview-update-duration-type.md) | :heavy_minus_sign: | Unit of time for the trial ('day', 'month', 'year'). | +| `cardRequired` | *boolean* | :heavy_minus_sign: | If true, payment method required to start trial. Customer is charged after trial ends. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-item-price-interval.md b/packages/sdk/docs/models/preview-update-item-price-interval.md index 331bff6f5..bd687b1b9 100644 --- a/packages/sdk/docs/models/preview-update-item-price-interval.md +++ b/packages/sdk/docs/models/preview-update-item-price-interval.md @@ -1,5 +1,7 @@ # PreviewUpdateItemPriceInterval +Billing interval. For consumable features, should match reset.interval. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-update-item-price.md b/packages/sdk/docs/models/preview-update-item-price.md index 220c9e373..d200a21d5 100644 --- a/packages/sdk/docs/models/preview-update-item-price.md +++ b/packages/sdk/docs/models/preview-update-item-price.md @@ -1,5 +1,7 @@ # PreviewUpdateItemPrice +Pricing for usage beyond included units. Omit for free features. + ## Example Usage ```typescript @@ -13,12 +15,12 @@ let value: PreviewUpdateItemPrice = { ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.PreviewUpdateTier](../models/preview-update-tier.md)[] | :heavy_minus_sign: | N/A | -| `interval` | [models.PreviewUpdateItemPriceInterval](../models/preview-update-item-price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_minus_sign: | N/A | -| `billingMethod` | [models.PreviewUpdateBillingMethod](../models/preview-update-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `amount` | *number* | :heavy_minus_sign: | Price per billing_units after included usage. Either 'amount' or 'tiers' is required. | +| `tiers` | [models.PreviewUpdateTier](../models/preview-update-tier.md)[] | :heavy_minus_sign: | Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. | +| `interval` | [models.PreviewUpdateItemPriceInterval](../models/preview-update-item-price-interval.md) | :heavy_check_mark: | Billing interval. For consumable features, should match reset.interval. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billingUnits` | *number* | :heavy_minus_sign: | Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). | +| `billingMethod` | [models.PreviewUpdateBillingMethod](../models/preview-update-billing-method.md) | :heavy_check_mark: | 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. | +| `maxPurchase` | *number* | :heavy_minus_sign: | Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-item.md b/packages/sdk/docs/models/preview-update-item.md index 6f29adac3..0b07e4567 100644 --- a/packages/sdk/docs/models/preview-update-item.md +++ b/packages/sdk/docs/models/preview-update-item.md @@ -12,12 +12,12 @@ let value: PreviewUpdateItem = { ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `included` | *number* | :heavy_minus_sign: | N/A | -| `unlimited` | *boolean* | :heavy_minus_sign: | N/A | -| `reset` | [models.PreviewUpdateReset](../models/preview-update-reset.md) | :heavy_minus_sign: | N/A | -| `price` | [models.PreviewUpdateItemPrice](../models/preview-update-item-price.md) | :heavy_minus_sign: | N/A | -| `proration` | [models.PreviewUpdateProration](../models/preview-update-proration.md) | :heavy_minus_sign: | N/A | -| `rollover` | [models.PreviewUpdateRollover](../models/preview-update-rollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature to configure. | +| `included` | *number* | :heavy_minus_sign: | Number of free units included. Balance resets to this each interval for consumable features. | +| `unlimited` | *boolean* | :heavy_minus_sign: | If true, customer has unlimited access to this feature. | +| `reset` | [models.PreviewUpdateReset](../models/preview-update-reset.md) | :heavy_minus_sign: | Reset configuration for consumable features. Omit for non-consumable features like seats. | +| `price` | [models.PreviewUpdateItemPrice](../models/preview-update-item-price.md) | :heavy_minus_sign: | Pricing for usage beyond included units. Omit for free features. | +| `proration` | [models.PreviewUpdateProration](../models/preview-update-proration.md) | :heavy_minus_sign: | Proration settings for prepaid features. Controls mid-cycle quantity change billing. | +| `rollover` | [models.PreviewUpdateRollover](../models/preview-update-rollover.md) | :heavy_minus_sign: | Rollover config for unused units. If set, unused included units carry over. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-on-decrease.md b/packages/sdk/docs/models/preview-update-on-decrease.md index 9015efdb6..8205cb0a1 100644 --- a/packages/sdk/docs/models/preview-update-on-decrease.md +++ b/packages/sdk/docs/models/preview-update-on-decrease.md @@ -1,5 +1,7 @@ # PreviewUpdateOnDecrease +Credit behavior when quantity decreases mid-cycle. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-update-on-increase.md b/packages/sdk/docs/models/preview-update-on-increase.md index 2d0494cfb..e6d6115ff 100644 --- a/packages/sdk/docs/models/preview-update-on-increase.md +++ b/packages/sdk/docs/models/preview-update-on-increase.md @@ -1,5 +1,7 @@ # PreviewUpdateOnIncrease +Billing behavior when quantity increases mid-cycle. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-update-price-interval.md b/packages/sdk/docs/models/preview-update-price-interval.md index b1a5ecd50..7f8dcbca5 100644 --- a/packages/sdk/docs/models/preview-update-price-interval.md +++ b/packages/sdk/docs/models/preview-update-price-interval.md @@ -1,5 +1,7 @@ # PreviewUpdatePriceInterval +Billing interval (e.g. 'month', 'year'). + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-update-price.md b/packages/sdk/docs/models/preview-update-price.md index 2b270cb86..d99d1de94 100644 --- a/packages/sdk/docs/models/preview-update-price.md +++ b/packages/sdk/docs/models/preview-update-price.md @@ -15,6 +15,6 @@ let value: PreviewUpdatePrice = { | Field | Type | Required | Description | | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_check_mark: | N/A | -| `interval` | [models.PreviewUpdatePriceInterval](../models/preview-update-price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `amount` | *number* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.PreviewUpdatePriceInterval](../models/preview-update-price-interval.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-proration.md b/packages/sdk/docs/models/preview-update-proration.md index a71c9503b..050ae0410 100644 --- a/packages/sdk/docs/models/preview-update-proration.md +++ b/packages/sdk/docs/models/preview-update-proration.md @@ -1,5 +1,7 @@ # PreviewUpdateProration +Proration settings for prepaid features. Controls mid-cycle quantity change billing. + ## Example Usage ```typescript @@ -15,5 +17,5 @@ let value: PreviewUpdateProration = { | Field | Type | Required | Description | | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `onIncrease` | [models.PreviewUpdateOnIncrease](../models/preview-update-on-increase.md) | :heavy_check_mark: | N/A | -| `onDecrease` | [models.PreviewUpdateOnDecrease](../models/preview-update-on-decrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| `onIncrease` | [models.PreviewUpdateOnIncrease](../models/preview-update-on-increase.md) | :heavy_check_mark: | Billing behavior when quantity increases mid-cycle. | +| `onDecrease` | [models.PreviewUpdateOnDecrease](../models/preview-update-on-decrease.md) | :heavy_check_mark: | Credit behavior when quantity decreases mid-cycle. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-reset-interval.md b/packages/sdk/docs/models/preview-update-reset-interval.md index a95452f32..0aa02965f 100644 --- a/packages/sdk/docs/models/preview-update-reset-interval.md +++ b/packages/sdk/docs/models/preview-update-reset-interval.md @@ -1,5 +1,7 @@ # PreviewUpdateResetInterval +Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/preview-update-reset.md b/packages/sdk/docs/models/preview-update-reset.md index 0c1660a20..0765a516d 100644 --- a/packages/sdk/docs/models/preview-update-reset.md +++ b/packages/sdk/docs/models/preview-update-reset.md @@ -1,5 +1,7 @@ # PreviewUpdateReset +Reset configuration for consumable features. Omit for non-consumable features like seats. + ## Example Usage ```typescript @@ -12,7 +14,7 @@ let value: PreviewUpdateReset = { ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `interval` | [models.PreviewUpdateResetInterval](../models/preview-update-reset-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `interval` | [models.PreviewUpdateResetInterval](../models/preview-update-reset-interval.md) | :heavy_check_mark: | Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-rollover.md b/packages/sdk/docs/models/preview-update-rollover.md index c9e3aa197..73f74a0da 100644 --- a/packages/sdk/docs/models/preview-update-rollover.md +++ b/packages/sdk/docs/models/preview-update-rollover.md @@ -1,5 +1,7 @@ # PreviewUpdateRollover +Rollover config for unused units. If set, unused included units carry over. + ## Example Usage ```typescript @@ -14,6 +16,6 @@ let value: PreviewUpdateRollover = { | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `max` | *number* | :heavy_minus_sign: | N/A | -| `expiryDurationType` | [models.PreviewUpdateExpiryDurationType](../models/preview-update-expiry-duration-type.md) | :heavy_check_mark: | N/A | -| `expiryDurationLength` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `max` | *number* | :heavy_minus_sign: | Max rollover units. Omit for unlimited rollover. | +| `expiryDurationType` | [models.PreviewUpdateExpiryDurationType](../models/preview-update-expiry-duration-type.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiryDurationLength` | *number* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview.md b/packages/sdk/docs/models/preview.md index d38bd912d..d8d0ac14e 100644 --- a/packages/sdk/docs/models/preview.md +++ b/packages/sdk/docs/models/preview.md @@ -41,7 +41,7 @@ let value: Preview = { | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `scenario` | [models.CheckScenario](../models/check-scenario.md) | :heavy_check_mark: | The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. | +| `scenario` | [models.Scenario](../models/scenario.md) | :heavy_check_mark: | The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. | | `title` | *string* | :heavy_check_mark: | A title suitable for displaying in a paywall or upgrade modal. | | `message` | *string* | :heavy_check_mark: | A message explaining why access was denied. | | `featureId` | *string* | :heavy_check_mark: | The ID of the feature that was checked. | diff --git a/packages/sdk/docs/models/proration.md b/packages/sdk/docs/models/proration.md deleted file mode 100644 index 05c6c5284..000000000 --- a/packages/sdk/docs/models/proration.md +++ /dev/null @@ -1,16 +0,0 @@ -# Proration - -## Example Usage - -```typescript -import { Proration } from "@useautumn/sdk"; - -let value: Proration = {}; -``` - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | -| `onIncrease` | [models.OnIncrease](../models/on-increase.md) | :heavy_minus_sign: | N/A | -| `onDecrease` | [models.OnDecrease](../models/on-decrease.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/scenario.md b/packages/sdk/docs/models/scenario.md index bb56d26cd..9d5921254 100644 --- a/packages/sdk/docs/models/scenario.md +++ b/packages/sdk/docs/models/scenario.md @@ -1,11 +1,13 @@ # Scenario +The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. + ## Example Usage ```typescript import { Scenario } from "@useautumn/sdk"; -let value: Scenario = "active"; +let value: Scenario = "usage_limit"; ``` ## Values @@ -13,5 +15,5 @@ let value: Scenario = "active"; This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. ```typescript -"scheduled" | "active" | "new" | "renew" | "upgrade" | "downgrade" | "cancel" | "expired" | "past_due" | Unrecognized +"usage_limit" | "feature_flag" | Unrecognized ``` \ No newline at end of file diff --git a/packages/sdk/docs/models/setup-payment-globals.md b/packages/sdk/docs/models/setup-payment-globals.md new file mode 100644 index 000000000..6e60d36b1 --- /dev/null +++ b/packages/sdk/docs/models/setup-payment-globals.md @@ -0,0 +1,15 @@ +# SetupPaymentGlobals + +## Example Usage + +```typescript +import { SetupPaymentGlobals } from "@useautumn/sdk"; + +let value: SetupPaymentGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/setup-payment-params.md b/packages/sdk/docs/models/setup-payment-params.md new file mode 100644 index 000000000..cb913dbf5 --- /dev/null +++ b/packages/sdk/docs/models/setup-payment-params.md @@ -0,0 +1,21 @@ +# SetupPaymentParams + +## Example Usage + +```typescript +import { SetupPaymentParams } from "@useautumn/sdk"; + +let value: SetupPaymentParams = { + customerId: "cus_123", + successUrl: "https://example.com/account/billing", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer | +| `successUrl` | *string* | :heavy_minus_sign: | URL to redirect to after successful payment setup. Must start with either http:// or https:// | +| `customerData` | [models.CustomerData](../models/customer-data.md) | :heavy_minus_sign: | Customer details to set when creating a customer | +| `checkoutSessionParams` | Record | :heavy_minus_sign: | Additional parameters for the checkout session | \ No newline at end of file diff --git a/packages/sdk/docs/models/setup-payment-response.md b/packages/sdk/docs/models/setup-payment-response.md new file mode 100644 index 000000000..ecb9949b8 --- /dev/null +++ b/packages/sdk/docs/models/setup-payment-response.md @@ -0,0 +1,21 @@ +# SetupPaymentResponse + +OK + +## Example Usage + +```typescript +import { SetupPaymentResponse } from "@useautumn/sdk"; + +let value: SetupPaymentResponse = { + customerId: "cus_123", + url: "https://bowed-hovercraft.com/", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer | +| `url` | *string* | :heavy_check_mark: | URL to the payment setup page | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-billing-method-request.md b/packages/sdk/docs/models/update-plan-billing-method-request.md new file mode 100644 index 000000000..3fcfc1ffd --- /dev/null +++ b/packages/sdk/docs/models/update-plan-billing-method-request.md @@ -0,0 +1,17 @@ +# UpdatePlanBillingMethodRequest + +'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + +## Example Usage + +```typescript +import { UpdatePlanBillingMethodRequest } from "@useautumn/sdk"; + +let value: UpdatePlanBillingMethodRequest = "usage_based"; +``` + +## Values + +```typescript +"prepaid" | "usage_based" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-billing-method-response.md b/packages/sdk/docs/models/update-plan-billing-method-response.md new file mode 100644 index 000000000..1c3d7ae7c --- /dev/null +++ b/packages/sdk/docs/models/update-plan-billing-method-response.md @@ -0,0 +1,19 @@ +# UpdatePlanBillingMethodResponse + +'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + +## Example Usage + +```typescript +import { UpdatePlanBillingMethodResponse } from "@useautumn/sdk"; + +let value: UpdatePlanBillingMethodResponse = "usage_based"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"prepaid" | "usage_based" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-credit-schema.md b/packages/sdk/docs/models/update-plan-credit-schema.md new file mode 100644 index 000000000..c73b5150f --- /dev/null +++ b/packages/sdk/docs/models/update-plan-credit-schema.md @@ -0,0 +1,19 @@ +# UpdatePlanCreditSchema + +## Example Usage + +```typescript +import { UpdatePlanCreditSchema } from "@useautumn/sdk"; + +let value: UpdatePlanCreditSchema = { + meteredFeatureId: "", + creditCost: 9878.94, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `meteredFeatureId` | *string* | :heavy_check_mark: | The ID of the metered feature (should be a single_use feature). | +| `creditCost` | *number* | :heavy_check_mark: | The credit cost of the metered feature. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-duration-type-request.md b/packages/sdk/docs/models/update-plan-duration-type-request.md new file mode 100644 index 000000000..823ca3a08 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-duration-type-request.md @@ -0,0 +1,17 @@ +# UpdatePlanDurationTypeRequest + +Unit of time for the trial ('day', 'month', 'year'). + +## Example Usage + +```typescript +import { UpdatePlanDurationTypeRequest } from "@useautumn/sdk"; + +let value: UpdatePlanDurationTypeRequest = "month"; +``` + +## Values + +```typescript +"day" | "month" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-duration-type-response.md b/packages/sdk/docs/models/update-plan-duration-type-response.md new file mode 100644 index 000000000..1a60b6ee9 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-duration-type-response.md @@ -0,0 +1,19 @@ +# UpdatePlanDurationTypeResponse + +Unit of time for the trial duration ('day', 'month', 'year'). + +## Example Usage + +```typescript +import { UpdatePlanDurationTypeResponse } from "@useautumn/sdk"; + +let value: UpdatePlanDurationTypeResponse = "day"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"day" | "month" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-env.md b/packages/sdk/docs/models/update-plan-env.md new file mode 100644 index 000000000..3027bd5dd --- /dev/null +++ b/packages/sdk/docs/models/update-plan-env.md @@ -0,0 +1,19 @@ +# UpdatePlanEnv + +Environment this plan belongs to ('sandbox' or 'live'). + +## Example Usage + +```typescript +import { UpdatePlanEnv } from "@useautumn/sdk"; + +let value: UpdatePlanEnv = "live"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"sandbox" | "live" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-expiry-duration-type-request.md b/packages/sdk/docs/models/update-plan-expiry-duration-type-request.md new file mode 100644 index 000000000..89747b93d --- /dev/null +++ b/packages/sdk/docs/models/update-plan-expiry-duration-type-request.md @@ -0,0 +1,17 @@ +# UpdatePlanExpiryDurationTypeRequest + +When rolled over units expire. + +## Example Usage + +```typescript +import { UpdatePlanExpiryDurationTypeRequest } from "@useautumn/sdk"; + +let value: UpdatePlanExpiryDurationTypeRequest = "month"; +``` + +## Values + +```typescript +"month" | "forever" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-expiry-duration-type-response.md b/packages/sdk/docs/models/update-plan-expiry-duration-type-response.md new file mode 100644 index 000000000..d886a3142 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-expiry-duration-type-response.md @@ -0,0 +1,19 @@ +# UpdatePlanExpiryDurationTypeResponse + +When rolled over units expire. + +## Example Usage + +```typescript +import { UpdatePlanExpiryDurationTypeResponse } from "@useautumn/sdk"; + +let value: UpdatePlanExpiryDurationTypeResponse = "month"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"month" | "forever" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-feature-display.md b/packages/sdk/docs/models/update-plan-feature-display.md new file mode 100644 index 000000000..12a3fcf71 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-feature-display.md @@ -0,0 +1,19 @@ +# UpdatePlanFeatureDisplay + +## Example Usage + +```typescript +import { UpdatePlanFeatureDisplay } from "@useautumn/sdk"; + +let value: UpdatePlanFeatureDisplay = { + singular: "", + plural: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `singular` | *string* | :heavy_check_mark: | The singular display name for the feature. | +| `plural` | *string* | :heavy_check_mark: | The plural display name for the feature. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-feature.md b/packages/sdk/docs/models/update-plan-feature.md new file mode 100644 index 000000000..842a819ef --- /dev/null +++ b/packages/sdk/docs/models/update-plan-feature.md @@ -0,0 +1,25 @@ +# UpdatePlanFeature + +The full feature object if expanded. + +## Example Usage + +```typescript +import { UpdatePlanFeature } from "@useautumn/sdk"; + +let value: UpdatePlanFeature = { + id: "", + type: "single_use", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `id` | *string* | :heavy_check_mark: | The ID of the feature, used to refer to it in other API calls like /track or /check. | +| `name` | *string* | :heavy_minus_sign: | The name of the feature. | +| `type` | [models.UpdatePlanType](../models/update-plan-type.md) | :heavy_check_mark: | The type of the feature | +| `display` | [models.UpdatePlanFeatureDisplay](../models/update-plan-feature-display.md) | :heavy_minus_sign: | Singular and plural display names for the feature. | +| `creditSchema` | [models.UpdatePlanCreditSchema](../models/update-plan-credit-schema.md)[] | :heavy_minus_sign: | Credit cost schema for credit system features. | +| `archived` | *boolean* | :heavy_minus_sign: | Whether or not the feature is archived. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-free-trial-request.md b/packages/sdk/docs/models/update-plan-free-trial-request.md new file mode 100644 index 000000000..cf2693ca3 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-free-trial-request.md @@ -0,0 +1,19 @@ +# UpdatePlanFreeTrialRequest + +## Example Usage + +```typescript +import { UpdatePlanFreeTrialRequest } from "@useautumn/sdk"; + +let value: UpdatePlanFreeTrialRequest = { + durationLength: 6946, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `durationLength` | *number* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `durationType` | [models.UpdatePlanDurationTypeRequest](../models/update-plan-duration-type-request.md) | :heavy_minus_sign: | Unit of time for the trial ('day', 'month', 'year'). | +| `cardRequired` | *boolean* | :heavy_minus_sign: | If true, payment method required to start trial. Customer is charged after trial ends. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-free-trial-response.md b/packages/sdk/docs/models/update-plan-free-trial-response.md new file mode 100644 index 000000000..74e60b419 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-free-trial-response.md @@ -0,0 +1,23 @@ +# UpdatePlanFreeTrialResponse + +Free trial configuration. If set, new customers can try this plan before being charged. + +## Example Usage + +```typescript +import { UpdatePlanFreeTrialResponse } from "@useautumn/sdk"; + +let value: UpdatePlanFreeTrialResponse = { + durationLength: 2586.93, + durationType: "year", + cardRequired: false, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `durationLength` | *number* | :heavy_check_mark: | Number of duration_type periods the trial lasts. | +| `durationType` | [models.UpdatePlanDurationTypeResponse](../models/update-plan-duration-type-response.md) | :heavy_check_mark: | Unit of time for the trial duration ('day', 'month', 'year'). | +| `cardRequired` | *boolean* | :heavy_check_mark: | Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-globals.md b/packages/sdk/docs/models/update-plan-globals.md new file mode 100644 index 000000000..525772be3 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-globals.md @@ -0,0 +1,15 @@ +# UpdatePlanGlobals + +## Example Usage + +```typescript +import { UpdatePlanGlobals } from "@useautumn/sdk"; + +let value: UpdatePlanGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-item-display.md b/packages/sdk/docs/models/update-plan-item-display.md new file mode 100644 index 000000000..11bcb3d42 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-item-display.md @@ -0,0 +1,20 @@ +# UpdatePlanItemDisplay + +Display text for showing this item in pricing pages. + +## Example Usage + +```typescript +import { UpdatePlanItemDisplay } from "@useautumn/sdk"; + +let value: UpdatePlanItemDisplay = { + primaryText: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primaryText` | *string* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondaryText` | *string* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-item-price-interval-request.md b/packages/sdk/docs/models/update-plan-item-price-interval-request.md new file mode 100644 index 000000000..47c968da0 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-item-price-interval-request.md @@ -0,0 +1,17 @@ +# UpdatePlanItemPriceIntervalRequest + +Billing interval. For consumable features, should match reset.interval. + +## Example Usage + +```typescript +import { UpdatePlanItemPriceIntervalRequest } from "@useautumn/sdk"; + +let value: UpdatePlanItemPriceIntervalRequest = "year"; +``` + +## Values + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-item-price-request.md b/packages/sdk/docs/models/update-plan-item-price-request.md new file mode 100644 index 000000000..e55afd7dc --- /dev/null +++ b/packages/sdk/docs/models/update-plan-item-price-request.md @@ -0,0 +1,26 @@ +# UpdatePlanItemPriceRequest + +Pricing for usage beyond included units. Omit for free features. + +## Example Usage + +```typescript +import { UpdatePlanItemPriceRequest } from "@useautumn/sdk"; + +let value: UpdatePlanItemPriceRequest = { + interval: "month", + billingMethod: "usage_based", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `amount` | *number* | :heavy_minus_sign: | Price per billing_units after included usage. Either 'amount' or 'tiers' is required. | +| `tiers` | [models.UpdatePlanTierRequest](../models/update-plan-tier-request.md)[] | :heavy_minus_sign: | Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. | +| `interval` | [models.UpdatePlanItemPriceIntervalRequest](../models/update-plan-item-price-interval-request.md) | :heavy_check_mark: | Billing interval. For consumable features, should match reset.interval. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billingUnits` | *number* | :heavy_minus_sign: | Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). | +| `billingMethod` | [models.UpdatePlanBillingMethodRequest](../models/update-plan-billing-method-request.md) | :heavy_check_mark: | 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. | +| `maxPurchase` | *number* | :heavy_minus_sign: | Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-item-price-response.md b/packages/sdk/docs/models/update-plan-item-price-response.md new file mode 100644 index 000000000..4537543a8 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-item-price-response.md @@ -0,0 +1,26 @@ +# UpdatePlanItemPriceResponse + +## Example Usage + +```typescript +import { UpdatePlanItemPriceResponse } from "@useautumn/sdk"; + +let value: UpdatePlanItemPriceResponse = { + interval: "month", + billingUnits: 1568.15, + billingMethod: "prepaid", + maxPurchase: 1397.52, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | Price per billing_units after included usage is consumed. Mutually exclusive with tiers. | +| `tiers` | [models.UpdatePlanTierResponse](../models/update-plan-tier-response.md)[] | :heavy_minus_sign: | Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. | +| `interval` | [models.UpdatePlanPriceItemIntervalResponse](../models/update-plan-price-item-interval-response.md) | :heavy_check_mark: | Billing interval for this price. For consumable features, should match reset.interval. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `billingUnits` | *number* | :heavy_check_mark: | Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). | +| `billingMethod` | [models.UpdatePlanBillingMethodResponse](../models/update-plan-billing-method-response.md) | :heavy_check_mark: | 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-item-request.md b/packages/sdk/docs/models/update-plan-item-request.md new file mode 100644 index 000000000..0d555ff50 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-item-request.md @@ -0,0 +1,23 @@ +# UpdatePlanItemRequest + +## Example Usage + +```typescript +import { UpdatePlanItemRequest } from "@useautumn/sdk"; + +let value: UpdatePlanItemRequest = { + featureId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature to configure. | +| `included` | *number* | :heavy_minus_sign: | Number of free units included. Balance resets to this each interval for consumable features. | +| `unlimited` | *boolean* | :heavy_minus_sign: | If true, customer has unlimited access to this feature. | +| `reset` | [models.UpdatePlanResetRequest](../models/update-plan-reset-request.md) | :heavy_minus_sign: | Reset configuration for consumable features. Omit for non-consumable features like seats. | +| `price` | [models.UpdatePlanItemPriceRequest](../models/update-plan-item-price-request.md) | :heavy_minus_sign: | Pricing for usage beyond included units. Omit for free features. | +| `proration` | [models.UpdatePlanProration](../models/update-plan-proration.md) | :heavy_minus_sign: | Proration settings for prepaid features. Controls mid-cycle quantity change billing. | +| `rollover` | [models.UpdatePlanRolloverRequest](../models/update-plan-rollover-request.md) | :heavy_minus_sign: | Rollover config for unused units. If set, unused included units carry over. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-item-response.md b/packages/sdk/docs/models/update-plan-item-response.md new file mode 100644 index 000000000..e70bd094e --- /dev/null +++ b/packages/sdk/docs/models/update-plan-item-response.md @@ -0,0 +1,30 @@ +# UpdatePlanItemResponse + +## Example Usage + +```typescript +import { UpdatePlanItemResponse } from "@useautumn/sdk"; + +let value: UpdatePlanItemResponse = { + featureId: "", + included: 7325.52, + unlimited: true, + reset: { + interval: "year", + }, + price: null, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature this item configures. | +| `feature` | [models.UpdatePlanFeature](../models/update-plan-feature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `included` | *number* | :heavy_check_mark: | Number of free units included. For consumable features, balance resets to this number each interval. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether the customer has unlimited access to this feature. | +| `reset` | [models.UpdatePlanResetResponse](../models/update-plan-reset-response.md) | :heavy_check_mark: | Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. | +| `price` | [models.UpdatePlanItemPriceResponse](../models/update-plan-item-price-response.md) | :heavy_check_mark: | Pricing configuration for usage beyond included units. Null if feature is entirely free. | +| `display` | [models.UpdatePlanItemDisplay](../models/update-plan-item-display.md) | :heavy_minus_sign: | Display text for showing this item in pricing pages. | +| `rollover` | [models.UpdatePlanRolloverResponse](../models/update-plan-rollover-response.md) | :heavy_minus_sign: | Rollover configuration for unused units. If set, unused included units roll over to the next period. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-on-decrease.md b/packages/sdk/docs/models/update-plan-on-decrease.md new file mode 100644 index 000000000..7ef6c9c0c --- /dev/null +++ b/packages/sdk/docs/models/update-plan-on-decrease.md @@ -0,0 +1,17 @@ +# UpdatePlanOnDecrease + +Credit behavior when quantity decreases mid-cycle. + +## Example Usage + +```typescript +import { UpdatePlanOnDecrease } from "@useautumn/sdk"; + +let value: UpdatePlanOnDecrease = "none"; +``` + +## Values + +```typescript +"prorate" | "prorate_immediately" | "prorate_next_cycle" | "none" | "no_prorations" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-on-increase.md b/packages/sdk/docs/models/update-plan-on-increase.md new file mode 100644 index 000000000..585c71d06 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-on-increase.md @@ -0,0 +1,17 @@ +# UpdatePlanOnIncrease + +Billing behavior when quantity increases mid-cycle. + +## Example Usage + +```typescript +import { UpdatePlanOnIncrease } from "@useautumn/sdk"; + +let value: UpdatePlanOnIncrease = "bill_next_cycle"; +``` + +## Values + +```typescript +"bill_immediately" | "prorate_immediately" | "prorate_next_cycle" | "bill_next_cycle" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-params.md b/packages/sdk/docs/models/update-plan-params.md new file mode 100644 index 000000000..39fbd32bd --- /dev/null +++ b/packages/sdk/docs/models/update-plan-params.md @@ -0,0 +1,33 @@ +# UpdatePlanParams + +## Example Usage + +```typescript +import { UpdatePlanParams } from "@useautumn/sdk"; + +let value: UpdatePlanParams = { + planId: "pro_plan", + name: "Pro Plan (Updated)", + price: { + amount: 15, + interval: "month", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `planId` | *string* | :heavy_check_mark: | The ID of the plan to update. | +| `group` | *string* | :heavy_minus_sign: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `name` | *string* | :heavy_minus_sign: | Display name of the plan. | +| `description` | *string* | :heavy_minus_sign: | N/A | +| `addOn` | *boolean* | :heavy_minus_sign: | Whether the plan is an add-on. | +| `autoEnable` | *boolean* | :heavy_minus_sign: | Whether the plan is automatically enabled. | +| `price` | [models.UpdatePlanPriceRequest](../models/update-plan-price-request.md) | :heavy_minus_sign: | The price of the plan. Set to null to remove the base price. | +| `items` | [models.UpdatePlanItemRequest](../models/update-plan-item-request.md)[] | :heavy_minus_sign: | Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. | +| `freeTrial` | [models.UpdatePlanFreeTrialRequest](../models/update-plan-free-trial-request.md) | :heavy_minus_sign: | The free trial of the plan. Set to null to remove the free trial. | +| `version` | *number* | :heavy_minus_sign: | N/A | +| `archived` | *boolean* | :heavy_minus_sign: | N/A | +| `newPlanId` | *string* | :heavy_minus_sign: | The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-price-display.md b/packages/sdk/docs/models/update-plan-price-display.md new file mode 100644 index 000000000..13b237d44 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-price-display.md @@ -0,0 +1,20 @@ +# UpdatePlanPriceDisplay + +Display text for showing this price in pricing pages. + +## Example Usage + +```typescript +import { UpdatePlanPriceDisplay } from "@useautumn/sdk"; + +let value: UpdatePlanPriceDisplay = { + primaryText: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `primaryText` | *string* | :heavy_check_mark: | Main display text (e.g. '$10' or '100 messages'). | +| `secondaryText` | *string* | :heavy_minus_sign: | Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-price-interval-request.md b/packages/sdk/docs/models/update-plan-price-interval-request.md new file mode 100644 index 000000000..308fdd7c2 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-price-interval-request.md @@ -0,0 +1,17 @@ +# UpdatePlanPriceIntervalRequest + +Billing interval (e.g. 'month', 'year'). + +## Example Usage + +```typescript +import { UpdatePlanPriceIntervalRequest } from "@useautumn/sdk"; + +let value: UpdatePlanPriceIntervalRequest = "one_off"; +``` + +## Values + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-price-interval-response.md b/packages/sdk/docs/models/update-plan-price-interval-response.md new file mode 100644 index 000000000..1bbe591e1 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-price-interval-response.md @@ -0,0 +1,19 @@ +# UpdatePlanPriceIntervalResponse + +Billing interval (e.g. 'month', 'year'). + +## Example Usage + +```typescript +import { UpdatePlanPriceIntervalResponse } from "@useautumn/sdk"; + +let value: UpdatePlanPriceIntervalResponse = "week"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-price-item-interval-response.md b/packages/sdk/docs/models/update-plan-price-item-interval-response.md new file mode 100644 index 000000000..e3ffa0745 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-price-item-interval-response.md @@ -0,0 +1,19 @@ +# UpdatePlanPriceItemIntervalResponse + +Billing interval for this price. For consumable features, should match reset.interval. + +## Example Usage + +```typescript +import { UpdatePlanPriceItemIntervalResponse } from "@useautumn/sdk"; + +let value: UpdatePlanPriceItemIntervalResponse = "month"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-price-request.md b/packages/sdk/docs/models/update-plan-price-request.md new file mode 100644 index 000000000..dfeacaa94 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-price-request.md @@ -0,0 +1,20 @@ +# UpdatePlanPriceRequest + +## Example Usage + +```typescript +import { UpdatePlanPriceRequest } from "@useautumn/sdk"; + +let value: UpdatePlanPriceRequest = { + amount: 412.83, + interval: "one_off", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.UpdatePlanPriceIntervalRequest](../models/update-plan-price-interval-request.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-price-response.md b/packages/sdk/docs/models/update-plan-price-response.md new file mode 100644 index 000000000..8ab119965 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-price-response.md @@ -0,0 +1,21 @@ +# UpdatePlanPriceResponse + +## Example Usage + +```typescript +import { UpdatePlanPriceResponse } from "@useautumn/sdk"; + +let value: UpdatePlanPriceResponse = { + amount: 3988.66, + interval: "week", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `amount` | *number* | :heavy_check_mark: | Base price amount for the plan. | +| `interval` | [models.UpdatePlanPriceIntervalResponse](../models/update-plan-price-interval-response.md) | :heavy_check_mark: | Billing interval (e.g. 'month', 'year'). | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals per billing cycle. Defaults to 1. | +| `display` | [models.UpdatePlanPriceDisplay](../models/update-plan-price-display.md) | :heavy_minus_sign: | Display text for showing this price in pricing pages. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-proration.md b/packages/sdk/docs/models/update-plan-proration.md new file mode 100644 index 000000000..cffd373fd --- /dev/null +++ b/packages/sdk/docs/models/update-plan-proration.md @@ -0,0 +1,21 @@ +# UpdatePlanProration + +Proration settings for prepaid features. Controls mid-cycle quantity change billing. + +## Example Usage + +```typescript +import { UpdatePlanProration } from "@useautumn/sdk"; + +let value: UpdatePlanProration = { + onIncrease: "prorate_immediately", + onDecrease: "none", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `onIncrease` | [models.UpdatePlanOnIncrease](../models/update-plan-on-increase.md) | :heavy_check_mark: | Billing behavior when quantity increases mid-cycle. | +| `onDecrease` | [models.UpdatePlanOnDecrease](../models/update-plan-on-decrease.md) | :heavy_check_mark: | Credit behavior when quantity decreases mid-cycle. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-reset-interval-request.md b/packages/sdk/docs/models/update-plan-reset-interval-request.md new file mode 100644 index 000000000..d30dc71cb --- /dev/null +++ b/packages/sdk/docs/models/update-plan-reset-interval-request.md @@ -0,0 +1,17 @@ +# UpdatePlanResetIntervalRequest + +Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + +## Example Usage + +```typescript +import { UpdatePlanResetIntervalRequest } from "@useautumn/sdk"; + +let value: UpdatePlanResetIntervalRequest = "one_off"; +``` + +## Values + +```typescript +"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-reset-interval-response.md b/packages/sdk/docs/models/update-plan-reset-interval-response.md new file mode 100644 index 000000000..d89b60eb3 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-reset-interval-response.md @@ -0,0 +1,19 @@ +# UpdatePlanResetIntervalResponse + +The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + +## Example Usage + +```typescript +import { UpdatePlanResetIntervalResponse } from "@useautumn/sdk"; + +let value: UpdatePlanResetIntervalResponse = "week"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-reset-request.md b/packages/sdk/docs/models/update-plan-reset-request.md new file mode 100644 index 000000000..6ee222528 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-reset-request.md @@ -0,0 +1,20 @@ +# UpdatePlanResetRequest + +Reset configuration for consumable features. Omit for non-consumable features like seats. + +## Example Usage + +```typescript +import { UpdatePlanResetRequest } from "@useautumn/sdk"; + +let value: UpdatePlanResetRequest = { + interval: "one_off", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `interval` | [models.UpdatePlanResetIntervalRequest](../models/update-plan-reset-interval-request.md) | :heavy_check_mark: | Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-reset-response.md b/packages/sdk/docs/models/update-plan-reset-response.md new file mode 100644 index 000000000..a91ea7b58 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-reset-response.md @@ -0,0 +1,18 @@ +# UpdatePlanResetResponse + +## Example Usage + +```typescript +import { UpdatePlanResetResponse } from "@useautumn/sdk"; + +let value: UpdatePlanResetResponse = { + interval: "semi_annual", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `interval` | [models.UpdatePlanResetIntervalResponse](../models/update-plan-reset-interval-response.md) | :heavy_check_mark: | The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-response.md b/packages/sdk/docs/models/update-plan-response.md new file mode 100644 index 000000000..3e4f687bd --- /dev/null +++ b/packages/sdk/docs/models/update-plan-response.md @@ -0,0 +1,85 @@ +# UpdatePlanResponse + +A plan defines a set of features, pricing, and entitlements that can be attached to customers. + +## Example Usage + +```typescript +import { UpdatePlanResponse } from "@useautumn/sdk"; + +let value: UpdatePlanResponse = { + id: "pro", + name: "Pro Plan", + description: null, + group: null, + version: 1, + addOn: false, + autoEnable: false, + price: { + amount: 10, + interval: "month", + display: { + primaryText: "", + }, + }, + items: [ + { + featureId: "", + included: 100, + unlimited: false, + reset: { + interval: "month", + }, + price: { + amount: 0.5, + interval: "month", + billingUnits: 1463.81, + billingMethod: "prepaid", + maxPurchase: 4443.11, + }, + display: { + primaryText: "", + }, + }, + { + featureId: "", + included: 0, + unlimited: false, + reset: null, + price: { + amount: 10, + interval: "month", + billingUnits: 5850.56, + billingMethod: "prepaid", + maxPurchase: 8502.08, + }, + display: { + primaryText: "", + }, + }, + ], + createdAt: 4378.26, + env: "sandbox", + archived: false, + baseVariantId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | Unique identifier for the plan. | +| `name` | *string* | :heavy_check_mark: | Display name of the plan. | +| `description` | *string* | :heavy_check_mark: | Optional description of the plan. | +| `group` | *string* | :heavy_check_mark: | Group identifier for organizing related plans. Plans in the same group are mutually exclusive. | +| `version` | *number* | :heavy_check_mark: | Version number of the plan. Incremented when plan configuration changes. | +| `addOn` | *boolean* | :heavy_check_mark: | Whether this is an add-on plan that can be attached alongside a main plan. | +| `autoEnable` | *boolean* | :heavy_check_mark: | If true, this plan is automatically attached when a customer is created. Used for free plans. | +| `price` | [models.UpdatePlanPriceResponse](../models/update-plan-price-response.md) | :heavy_check_mark: | Base recurring price for the plan. Null for free plans or usage-only plans. | +| `items` | [models.UpdatePlanItemResponse](../models/update-plan-item-response.md)[] | :heavy_check_mark: | Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. | +| `freeTrial` | [models.UpdatePlanFreeTrialResponse](../models/update-plan-free-trial-response.md) | :heavy_minus_sign: | Free trial configuration. If set, new customers can try this plan before being charged. | +| `createdAt` | *number* | :heavy_check_mark: | Unix timestamp (ms) when the plan was created. | +| `env` | [models.UpdatePlanEnv](../models/update-plan-env.md) | :heavy_check_mark: | Environment this plan belongs to ('sandbox' or 'live'). | +| `archived` | *boolean* | :heavy_check_mark: | Whether the plan is archived. Archived plans cannot be attached to new customers. | +| `baseVariantId` | *string* | :heavy_check_mark: | If this is a variant, the ID of the base plan it was created from. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-rollover-request.md b/packages/sdk/docs/models/update-plan-rollover-request.md new file mode 100644 index 000000000..27f4879d7 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-rollover-request.md @@ -0,0 +1,21 @@ +# UpdatePlanRolloverRequest + +Rollover config for unused units. If set, unused included units carry over. + +## Example Usage + +```typescript +import { UpdatePlanRolloverRequest } from "@useautumn/sdk"; + +let value: UpdatePlanRolloverRequest = { + expiryDurationType: "forever", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `max` | *number* | :heavy_minus_sign: | Max rollover units. Omit for unlimited rollover. | +| `expiryDurationType` | [models.UpdatePlanExpiryDurationTypeRequest](../models/update-plan-expiry-duration-type-request.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiryDurationLength` | *number* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-rollover-response.md b/packages/sdk/docs/models/update-plan-rollover-response.md new file mode 100644 index 000000000..8bad9b30e --- /dev/null +++ b/packages/sdk/docs/models/update-plan-rollover-response.md @@ -0,0 +1,22 @@ +# UpdatePlanRolloverResponse + +Rollover configuration for unused units. If set, unused included units roll over to the next period. + +## Example Usage + +```typescript +import { UpdatePlanRolloverResponse } from "@useautumn/sdk"; + +let value: UpdatePlanRolloverResponse = { + max: 7363.87, + expiryDurationType: "month", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `max` | *number* | :heavy_check_mark: | Maximum rollover units. Null for unlimited rollover. | +| `expiryDurationType` | [models.UpdatePlanExpiryDurationTypeResponse](../models/update-plan-expiry-duration-type-response.md) | :heavy_check_mark: | When rolled over units expire. | +| `expiryDurationLength` | *number* | :heavy_minus_sign: | Number of periods before expiry. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-tier-request.md b/packages/sdk/docs/models/update-plan-tier-request.md new file mode 100644 index 000000000..25ee57495 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-tier-request.md @@ -0,0 +1,19 @@ +# UpdatePlanTierRequest + +## Example Usage + +```typescript +import { UpdatePlanTierRequest } from "@useautumn/sdk"; + +let value: UpdatePlanTierRequest = { + to: 978.34, + amount: 8885.15, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | +| `to` | *models.UpdatePlanToRequest* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-tier-response.md b/packages/sdk/docs/models/update-plan-tier-response.md new file mode 100644 index 000000000..fd4d5aba2 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-tier-response.md @@ -0,0 +1,19 @@ +# UpdatePlanTierResponse + +## Example Usage + +```typescript +import { UpdatePlanTierResponse } from "@useautumn/sdk"; + +let value: UpdatePlanTierResponse = { + to: 2736.44, + amount: 9622.83, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- | +| `to` | *models.UpdatePlanToResponse* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-plan-to-request.md b/packages/sdk/docs/models/update-plan-to-request.md new file mode 100644 index 000000000..19de0d751 --- /dev/null +++ b/packages/sdk/docs/models/update-plan-to-request.md @@ -0,0 +1,17 @@ +# UpdatePlanToRequest + + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/update-plan-to-response.md b/packages/sdk/docs/models/update-plan-to-response.md new file mode 100644 index 000000000..95d1c8e8c --- /dev/null +++ b/packages/sdk/docs/models/update-plan-to-response.md @@ -0,0 +1,17 @@ +# UpdatePlanToResponse + + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/update-plan-type.md b/packages/sdk/docs/models/update-plan-type.md new file mode 100644 index 000000000..286ef6a9d --- /dev/null +++ b/packages/sdk/docs/models/update-plan-type.md @@ -0,0 +1,19 @@ +# UpdatePlanType + +The type of the feature + +## Example Usage + +```typescript +import { UpdatePlanType } from "@useautumn/sdk"; + +let value: UpdatePlanType = "boolean"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"static" | "boolean" | "single_use" | "continuous_use" | "credit_system" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/sdks/billing/README.md b/packages/sdk/docs/sdks/billing/README.md index 3f8ef93ab..c1331f5a3 100644 --- a/packages/sdk/docs/sdks/billing/README.md +++ b/packages/sdk/docs/sdks/billing/README.md @@ -121,6 +121,7 @@ const response = await client.billing.previewUpdate({ customerId: "cus_123", pla @returns A preview response with line items showing prorated charges or credits for the proposed changes. * [openCustomerPortal](#opencustomerportal) - Create a billing portal session for a customer to manage their subscription. +* [setupPayment](#setuppayment) - Create a payment setup session for a customer to add or update their payment method. ## attach @@ -639,6 +640,83 @@ run(); ### Errors +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## setupPayment + +Create a payment setup session for a customer to add or update their payment method. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.billing.setupPayment({ + customerId: "cus_123", + successUrl: "https://example.com/account/billing", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { billingSetupPayment } from "@useautumn/sdk/funcs/billing-setup-payment.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await billingSetupPayment(autumn, { + customerId: "cus_123", + successUrl: "https://example.com/account/billing", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("billingSetupPayment failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.SetupPaymentParams](../../models/setup-payment-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.SetupPaymentResponse](../../models/setup-payment-response.md)\>** + +### Errors + | Error Type | Status Code | Content Type | | ------------------------- | ------------------------- | ------------------------- | | models.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/packages/sdk/docs/sdks/plans/README.md b/packages/sdk/docs/sdks/plans/README.md index 1be0bf7ad..0d6bc90b4 100644 --- a/packages/sdk/docs/sdks/plans/README.md +++ b/packages/sdk/docs/sdks/plans/README.md @@ -4,11 +4,285 @@ ### Available Operations +* [create](#create) - Create a plan +* [get](#get) - Get a plan * [list](#list) - List all plans +* [update](#update) - Update a plan +* [delete](#delete) - Delete a plan + +## create + +Creates a new plan with optional base price and feature configurations. + +Use this to programmatically create pricing plans. See [How plans work](/documentation/pricing/plans) for concepts. + +@example +```typescript +// Create a free plan with limited features +const response = await client.plans.create({ + planId: "free_plan", + name: "Free", + autoEnable: true, + items: [{"featureId":"messages","included":100,"reset":{"interval":"month"}}], +}); +``` + +@example +```typescript +// Create a paid plan with base price and usage-based feature +const response = await client.plans.create({ + planId: "pro_plan", + name: "Pro Plan", + price: {"amount":10,"interval":"month"}, + items: [{"featureId":"messages","included":1000,"reset":{"interval":"month"},"price":{"amount":0.01,"interval":"month","billingUnits":1,"billingMethod":"usage_based"}}], +}); +``` + +@example +```typescript +// Create a plan with prepaid seats +const response = await client.plans.create({ + planId: "team_plan", + name: "Team Plan", + price: {"amount":49,"interval":"month"}, + items: [{"featureId":"seats","included":5,"price":{"amount":10,"interval":"month","billingUnits":1,"billingMethod":"prepaid"}}], +}); +``` + +@example +```typescript +// Create an add-on plan +const response = await client.plans.create({ + planId: "analytics_addon", + name: "Advanced Analytics", + addOn: true, + price: {"amount":20,"interval":"month"}, +}); +``` + +@example +```typescript +// Create a plan with tiered pricing +const response = await client.plans.create({ planId: "api_plan", name: "API Plan", items: [{"featureId":"api_calls","included":1000,"reset":{"interval":"month"},"price":{"tiers":[{"to":10000,"amount":0.001},{"to":100000,"amount":0.0005},{"to":"inf","amount":0.0001}],"interval":"month","billingUnits":1,"billingMethod":"usage_based"}}] }); +``` + +@example +```typescript +// Create a plan with free trial +const response = await client.plans.create({ + planId: "premium_plan", + name: "Premium", + price: {"amount":99,"interval":"month"}, + freeTrial: {"durationLength":14,"durationType":"day","cardRequired":true}, +}); +``` + +@param planId - The ID of the plan to create. +@param group - Group identifier for organizing related plans. Plans in the same group are mutually exclusive. (optional) +@param name - Display name of the plan. +@param description - Optional description of the plan. (optional) +@param addOn - If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. (optional) +@param autoEnable - If true, plan is automatically attached when a customer is created. Use for free tiers. (optional) +@param price - Base recurring price for the plan. Omit for free or usage-only plans. (optional) +@param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional) +@param freeTrial - Free trial configuration. Customers can try this plan before being charged. (optional) + +@returns The created plan object. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.plans.create({ + planId: "free_plan", + name: "Free", + autoEnable: true, + items: [ + { + featureId: "messages", + included: 100, + reset: { + interval: "month", + }, + }, + ], + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { plansCreate } from "@useautumn/sdk/funcs/plans-create.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await plansCreate(autumn, { + planId: "free_plan", + name: "Free", + autoEnable: true, + items: [ + { + featureId: "messages", + included: 100, + reset: { + interval: "month", + }, + }, + ], + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("plansCreate failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.CreatePlanParams](../../models/create-plan-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.CreatePlanResponse](../../models/create-plan-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## get + +Retrieves a single plan by its ID. + +Use this to fetch the full configuration of a specific plan, including its features and pricing. + +@example +```typescript +// Get a plan by ID +const response = await client.plans.get({ planId: "pro_plan" }); +``` + +@example +```typescript +// Get a specific version of a plan +const response = await client.plans.get({ planId: "pro_plan", version: 2 }); +``` + +@param planId - The ID of the plan to retrieve. +@param version - The version of the plan to get. Defaults to the latest version. (optional) + +@returns The plan object with its full configuration. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.plans.get({ + planId: "pro_plan", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { plansGet } from "@useautumn/sdk/funcs/plans-get.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await plansGet(autumn, { + planId: "pro_plan", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("plansGet failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.GetPlanParams](../../models/get-plan-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.GetPlanResponse](../../models/get-plan-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | ## list -List all plans +Lists all plans in the current environment. + +Use this to retrieve all plans for displaying pricing pages or managing plan configurations. + +@returns A list of all plans with their pricing and feature configurations. ### Example Usage @@ -22,7 +296,7 @@ const autumn = new Autumn({ }); async function run() { - const result = await autumn.plans.list(); + const result = await autumn.plans.list({}); console.log(result); } @@ -46,7 +320,7 @@ const autumn = new AutumnCore({ }); async function run() { - const res = await plansList(autumn); + const res = await plansList(autumn, {}); if (res.ok) { const { value: result } = res; console.log(result); @@ -62,7 +336,7 @@ run(); | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [models.ListPlansRequest](../../models/list-plans-request.md) | :heavy_check_mark: | The request object to use for the request. | +| `request` | [models.ListPlansParams](../../models/list-plans-params.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | @@ -73,6 +347,229 @@ run(); ### Errors +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## update + +Updates an existing plan. Creates a new version unless `disableVersion` is set. + +Use this to modify plan properties, pricing, or feature configurations. See [Adding features to plans](/documentation/pricing/plan-features) for item configuration. + +@example +```typescript +// Update plan name and price +const response = await client.plans.update({ planId: "pro_plan", name: "Pro Plan (Updated)", price: {"amount":15,"interval":"month"} }); +``` + +@example +```typescript +// Add a feature to an existing plan +const response = await client.plans.update({ planId: "pro_plan", items: [{"featureId":"messages","included":1000,"reset":{"interval":"month"}},{"featureId":"storage","included":10,"reset":{"interval":"month"}}] }); +``` + +@example +```typescript +// Remove the base price (make usage-only) +const response = await client.plans.update({ planId: "pro_plan", price: null }); +``` + +@example +```typescript +// Archive a plan +const response = await client.plans.update({ planId: "old_plan", archived: true }); +``` + +@example +```typescript +// Update feature's included amount +const response = await client.plans.update({ planId: "pro_plan", items: [{"featureId":"messages","included":2000,"reset":{"interval":"month"}}] }); +``` + +@param planId - The ID of the plan to update. +@param group - Group identifier for organizing related plans. Plans in the same group are mutually exclusive. (optional) +@param name - Display name of the plan. (optional) +@param addOn - Whether the plan is an add-on. (optional) +@param autoEnable - Whether the plan is automatically enabled. (optional) +@param price - The price of the plan. Set to null to remove the base price. (optional) +@param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional) +@param freeTrial - The free trial of the plan. Set to null to remove the free trial. (optional) +@param newPlanId - The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. (optional) + +@returns The updated plan object. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.plans.update({ + planId: "pro_plan", + name: "Pro Plan (Updated)", + price: { + amount: 15, + interval: "month", + }, + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { plansUpdate } from "@useautumn/sdk/funcs/plans-update.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await plansUpdate(autumn, { + planId: "pro_plan", + name: "Pro Plan (Updated)", + price: { + amount: 15, + interval: "month", + }, + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("plansUpdate failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.UpdatePlanParams](../../models/update-plan-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.UpdatePlanResponse](../../models/update-plan-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## delete + +Deletes a plan by its ID. + +Use this to permanently remove a plan. Plans with active customers cannot be deleted - archive them instead. + +@example +```typescript +// Delete a plan +const response = await client.plans.delete({ planId: "unused_plan" }); +``` + +@example +```typescript +// Delete all versions of a plan +const response = await client.plans.delete({ planId: "legacy_plan", allVersions: true }); +``` + +@param planId - The ID of the plan to delete. +@param allVersions - If true, deletes all versions of the plan. Otherwise, only deletes the latest version. (optional) + +@returns A success flag indicating the plan was deleted. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.plans.delete({ + planId: "unused_plan", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { plansDelete } from "@useautumn/sdk/funcs/plans-delete.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await plansDelete(autumn, { + planId: "unused_plan", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("plansDelete failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.DeletePlanParams](../../models/delete-plan-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.DeletePlanResponse](../../models/delete-plan-response.md)\>** + +### Errors + | Error Type | Status Code | Content Type | | ------------------------- | ------------------------- | ------------------------- | | models.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/packages/sdk/jsr.json b/packages/sdk/jsr.json index 2955bcaf5..13504f125 100644 --- a/packages/sdk/jsr.json +++ b/packages/sdk/jsr.json @@ -2,7 +2,7 @@ { "name": "@useautumn/sdk", - "version": "0.10.8", + "version": "0.10.15", "exports": { ".": "./src/index.ts", "./models": "./src/models/index.ts", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index e73317b39..2ed4b0912 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@useautumn/sdk", - "version": "0.10.8", + "version": "0.10.15", "author": "Speakeasy", "main": "./dist/commonjs/index.js", "module": "./dist/esm/index.js", diff --git a/packages/sdk/src/funcs/billing-setup-payment.ts b/packages/sdk/src/funcs/billing-setup-payment.ts new file mode 100644 index 000000000..e30ea0c1e --- /dev/null +++ b/packages/sdk/src/funcs/billing-setup-payment.ts @@ -0,0 +1,163 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Create a payment setup session for a customer to add or update their payment method. + */ +export function billingSetupPayment( + client: AutumnCore, + request: models.SetupPaymentParams, + options?: RequestOptions, +): APIPromise< + Result< + models.SetupPaymentResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.SetupPaymentParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.SetupPaymentResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.SetupPaymentParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/billing.setup_payment")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "setupPayment", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.SetupPaymentResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.SetupPaymentResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/funcs/plans-create.ts b/packages/sdk/src/funcs/plans-create.ts new file mode 100644 index 000000000..1f6e62132 --- /dev/null +++ b/packages/sdk/src/funcs/plans-create.ts @@ -0,0 +1,241 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Create a plan + * + * @remarks + * Creates a new plan with optional base price and feature configurations. + * + * Use this to programmatically create pricing plans. See [How plans work](/documentation/pricing/plans) for concepts. + * + * @example + * ```typescript + * // Create a free plan with limited features + * const response = await client.plans.create({ + * planId: "free_plan", + * name: "Free", + * autoEnable: true, + * items: [{"featureId":"messages","included":100,"reset":{"interval":"month"}}], + * }); + * ``` + * + * @example + * ```typescript + * // Create a paid plan with base price and usage-based feature + * const response = await client.plans.create({ + * planId: "pro_plan", + * name: "Pro Plan", + * price: {"amount":10,"interval":"month"}, + * items: [{"featureId":"messages","included":1000,"reset":{"interval":"month"},"price":{"amount":0.01,"interval":"month","billingUnits":1,"billingMethod":"usage_based"}}], + * }); + * ``` + * + * @example + * ```typescript + * // Create a plan with prepaid seats + * const response = await client.plans.create({ + * planId: "team_plan", + * name: "Team Plan", + * price: {"amount":49,"interval":"month"}, + * items: [{"featureId":"seats","included":5,"price":{"amount":10,"interval":"month","billingUnits":1,"billingMethod":"prepaid"}}], + * }); + * ``` + * + * @example + * ```typescript + * // Create an add-on plan + * const response = await client.plans.create({ + * planId: "analytics_addon", + * name: "Advanced Analytics", + * addOn: true, + * price: {"amount":20,"interval":"month"}, + * }); + * ``` + * + * @example + * ```typescript + * // Create a plan with tiered pricing + * const response = await client.plans.create({ planId: "api_plan", name: "API Plan", items: [{"featureId":"api_calls","included":1000,"reset":{"interval":"month"},"price":{"tiers":[{"to":10000,"amount":0.001},{"to":100000,"amount":0.0005},{"to":"inf","amount":0.0001}],"interval":"month","billingUnits":1,"billingMethod":"usage_based"}}] }); + * ``` + * + * @example + * ```typescript + * // Create a plan with free trial + * const response = await client.plans.create({ + * planId: "premium_plan", + * name: "Premium", + * price: {"amount":99,"interval":"month"}, + * freeTrial: {"durationLength":14,"durationType":"day","cardRequired":true}, + * }); + * ``` + * + * @param planId - The ID of the plan to create. + * @param group - Group identifier for organizing related plans. Plans in the same group are mutually exclusive. (optional) + * @param name - Display name of the plan. + * @param description - Optional description of the plan. (optional) + * @param addOn - If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. (optional) + * @param autoEnable - If true, plan is automatically attached when a customer is created. Use for free tiers. (optional) + * @param price - Base recurring price for the plan. Omit for free or usage-only plans. (optional) + * @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional) + * @param freeTrial - Free trial configuration. Customers can try this plan before being charged. (optional) + * + * @returns The created plan object. + */ +export function plansCreate( + client: AutumnCore, + request: models.CreatePlanParams, + options?: RequestOptions, +): APIPromise< + Result< + models.CreatePlanResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.CreatePlanParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.CreatePlanResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.CreatePlanParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/plans.create")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "createPlan", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.CreatePlanResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.CreatePlanResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/funcs/plans-delete.ts b/packages/sdk/src/funcs/plans-delete.ts new file mode 100644 index 000000000..ec4c77c9c --- /dev/null +++ b/packages/sdk/src/funcs/plans-delete.ts @@ -0,0 +1,185 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete a plan + * + * @remarks + * Deletes a plan by its ID. + * + * Use this to permanently remove a plan. Plans with active customers cannot be deleted - archive them instead. + * + * @example + * ```typescript + * // Delete a plan + * const response = await client.plans.delete({ planId: "unused_plan" }); + * ``` + * + * @example + * ```typescript + * // Delete all versions of a plan + * const response = await client.plans.delete({ planId: "legacy_plan", allVersions: true }); + * ``` + * + * @param planId - The ID of the plan to delete. + * @param allVersions - If true, deletes all versions of the plan. Otherwise, only deletes the latest version. (optional) + * + * @returns A success flag indicating the plan was deleted. + */ +export function plansDelete( + client: AutumnCore, + request: models.DeletePlanParams, + options?: RequestOptions, +): APIPromise< + Result< + models.DeletePlanResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.DeletePlanParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.DeletePlanResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.DeletePlanParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/plans.delete")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "deletePlan", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.DeletePlanResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.DeletePlanResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/funcs/plans-get.ts b/packages/sdk/src/funcs/plans-get.ts new file mode 100644 index 000000000..2af9cd13c --- /dev/null +++ b/packages/sdk/src/funcs/plans-get.ts @@ -0,0 +1,185 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Get a plan + * + * @remarks + * Retrieves a single plan by its ID. + * + * Use this to fetch the full configuration of a specific plan, including its features and pricing. + * + * @example + * ```typescript + * // Get a plan by ID + * const response = await client.plans.get({ planId: "pro_plan" }); + * ``` + * + * @example + * ```typescript + * // Get a specific version of a plan + * const response = await client.plans.get({ planId: "pro_plan", version: 2 }); + * ``` + * + * @param planId - The ID of the plan to retrieve. + * @param version - The version of the plan to get. Defaults to the latest version. (optional) + * + * @returns The plan object with its full configuration. + */ +export function plansGet( + client: AutumnCore, + request: models.GetPlanParams, + options?: RequestOptions, +): APIPromise< + Result< + models.GetPlanResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.GetPlanParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.GetPlanResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.GetPlanParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/plans.get")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "getPlan", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.GetPlanResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.GetPlanResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/funcs/plans-list.ts b/packages/sdk/src/funcs/plans-list.ts index 87ff687d8..3ba5652a7 100644 --- a/packages/sdk/src/funcs/plans-list.ts +++ b/packages/sdk/src/funcs/plans-list.ts @@ -27,10 +27,17 @@ import { Result } from "../types/fp.js"; /** * List all plans + * + * @remarks + * Lists all plans in the current environment. + * + * Use this to retrieve all plans for displaying pricing pages or managing plan configurations. + * + * @returns A list of all plans with their pricing and feature configurations. */ export function plansList( client: AutumnCore, - request?: models.ListPlansRequest | undefined, + request?: models.ListPlansParams | undefined, options?: RequestOptions, ): APIPromise< Result< @@ -54,7 +61,7 @@ export function plansList( async function $do( client: AutumnCore, - request?: models.ListPlansRequest | undefined, + request?: models.ListPlansParams | undefined, options?: RequestOptions, ): Promise< [ @@ -75,7 +82,7 @@ async function $do( const parsed = safeParse( request, (value) => - z.parse(z.optional(models.ListPlansRequest$outboundSchema), value), + z.parse(z.optional(models.ListPlansParams$outboundSchema), value), "Input validation failed", ); if (!parsed.ok) { diff --git a/packages/sdk/src/funcs/plans-update.ts b/packages/sdk/src/funcs/plans-update.ts new file mode 100644 index 000000000..3d31c3c41 --- /dev/null +++ b/packages/sdk/src/funcs/plans-update.ts @@ -0,0 +1,210 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Update a plan + * + * @remarks + * Updates an existing plan. Creates a new version unless `disableVersion` is set. + * + * Use this to modify plan properties, pricing, or feature configurations. See [Adding features to plans](/documentation/pricing/plan-features) for item configuration. + * + * @example + * ```typescript + * // Update plan name and price + * const response = await client.plans.update({ planId: "pro_plan", name: "Pro Plan (Updated)", price: {"amount":15,"interval":"month"} }); + * ``` + * + * @example + * ```typescript + * // Add a feature to an existing plan + * const response = await client.plans.update({ planId: "pro_plan", items: [{"featureId":"messages","included":1000,"reset":{"interval":"month"}},{"featureId":"storage","included":10,"reset":{"interval":"month"}}] }); + * ``` + * + * @example + * ```typescript + * // Remove the base price (make usage-only) + * const response = await client.plans.update({ planId: "pro_plan", price: null }); + * ``` + * + * @example + * ```typescript + * // Archive a plan + * const response = await client.plans.update({ planId: "old_plan", archived: true }); + * ``` + * + * @example + * ```typescript + * // Update feature's included amount + * const response = await client.plans.update({ planId: "pro_plan", items: [{"featureId":"messages","included":2000,"reset":{"interval":"month"}}] }); + * ``` + * + * @param planId - The ID of the plan to update. + * @param group - Group identifier for organizing related plans. Plans in the same group are mutually exclusive. (optional) + * @param name - Display name of the plan. (optional) + * @param addOn - Whether the plan is an add-on. (optional) + * @param autoEnable - Whether the plan is automatically enabled. (optional) + * @param price - The price of the plan. Set to null to remove the base price. (optional) + * @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional) + * @param freeTrial - The free trial of the plan. Set to null to remove the free trial. (optional) + * @param newPlanId - The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. (optional) + * + * @returns The updated plan object. + */ +export function plansUpdate( + client: AutumnCore, + request: models.UpdatePlanParams, + options?: RequestOptions, +): APIPromise< + Result< + models.UpdatePlanResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.UpdatePlanParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.UpdatePlanResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.UpdatePlanParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/plans.update")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "updatePlan", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.UpdatePlanResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.UpdatePlanResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/lib/config.ts b/packages/sdk/src/lib/config.ts index fe01b5cbc..c7ade4f8c 100644 --- a/packages/sdk/src/lib/config.ts +++ b/packages/sdk/src/lib/config.ts @@ -66,7 +66,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "2.1.0", - sdkVersion: "0.10.8", + sdkVersion: "0.10.15", genVersion: "2.824.1", - userAgent: "speakeasy-sdk/typescript 0.10.8 2.824.1 2.1.0 @useautumn/sdk", + userAgent: "speakeasy-sdk/typescript 0.10.15 2.824.1 2.1.0 @useautumn/sdk", } as const; diff --git a/packages/sdk/src/models/billing-attach-op.ts b/packages/sdk/src/models/billing-attach-op.ts index 821ac49b5..9ec756afd 100644 --- a/packages/sdk/src/models/billing-attach-op.ts +++ b/packages/sdk/src/models/billing-attach-op.ts @@ -22,21 +22,39 @@ export type BillingAttachFeatureQuantity = { adjustable?: boolean | undefined; }; +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ export const BillingAttachDurationType = { Day: "day", Month: "month", Year: "year", } as const; +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ export type BillingAttachDurationType = ClosedEnum< typeof BillingAttachDurationType >; export type BillingAttachFreeTrial = { + /** + * Number of duration_type periods the trial lasts. + */ durationLength: number; + /** + * Unit of time for the trial ('day', 'month', 'year'). + */ durationType?: BillingAttachDurationType | undefined; + /** + * If true, payment method required to start trial. Customer is charged after trial ends. + */ cardRequired?: boolean | undefined; }; +/** + * Billing interval (e.g. 'month', 'year'). + */ export const BillingAttachPriceInterval = { OneOff: "one_off", Week: "week", @@ -45,16 +63,31 @@ export const BillingAttachPriceInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ export type BillingAttachPriceInterval = ClosedEnum< typeof BillingAttachPriceInterval >; export type BillingAttachPrice = { + /** + * Base price amount for the plan. + */ amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ interval: BillingAttachPriceInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ intervalCount?: number | undefined; }; +/** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ export const BillingAttachResetInterval = { OneOff: "one_off", Minute: "minute", @@ -66,12 +99,24 @@ export const BillingAttachResetInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ export type BillingAttachResetInterval = ClosedEnum< typeof BillingAttachResetInterval >; +/** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ export type BillingAttachReset = { + /** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ interval: BillingAttachResetInterval; + /** + * Number of intervals between resets. Defaults to 1. + */ intervalCount?: number | undefined; }; @@ -82,6 +127,9 @@ export type BillingAttachTier = { amount: number; }; +/** + * Billing interval. For consumable features, should match reset.interval. + */ export const BillingAttachItemPriceInterval = { OneOff: "one_off", Week: "week", @@ -90,38 +138,80 @@ export const BillingAttachItemPriceInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Billing interval. For consumable features, should match reset.interval. + */ export type BillingAttachItemPriceInterval = ClosedEnum< typeof BillingAttachItemPriceInterval >; +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ export const BillingAttachBillingMethod = { Prepaid: "prepaid", UsageBased: "usage_based", } as const; +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ export type BillingAttachBillingMethod = ClosedEnum< typeof BillingAttachBillingMethod >; +/** + * Pricing for usage beyond included units. Omit for free features. + */ export type BillingAttachItemPrice = { + /** + * Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + */ amount?: number | undefined; + /** + * Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + */ tiers?: Array | undefined; + /** + * Billing interval. For consumable features, should match reset.interval. + */ interval: BillingAttachItemPriceInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ intervalCount?: number | undefined; + /** + * Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + */ billingUnits?: number | undefined; + /** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ billingMethod: BillingAttachBillingMethod; + /** + * Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + */ maxPurchase?: number | undefined; }; +/** + * Billing behavior when quantity increases mid-cycle. + */ export const BillingAttachOnIncrease = { BillImmediately: "bill_immediately", ProrateImmediately: "prorate_immediately", ProrateNextCycle: "prorate_next_cycle", BillNextCycle: "bill_next_cycle", } as const; +/** + * Billing behavior when quantity increases mid-cycle. + */ export type BillingAttachOnIncrease = ClosedEnum< typeof BillingAttachOnIncrease >; +/** + * Credit behavior when quantity decreases mid-cycle. + */ export const BillingAttachOnDecrease = { Prorate: "prorate", ProrateImmediately: "prorate_immediately", @@ -129,36 +219,87 @@ export const BillingAttachOnDecrease = { None: "none", NoProrations: "no_prorations", } as const; +/** + * Credit behavior when quantity decreases mid-cycle. + */ export type BillingAttachOnDecrease = ClosedEnum< typeof BillingAttachOnDecrease >; +/** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ export type BillingAttachProration = { + /** + * Billing behavior when quantity increases mid-cycle. + */ onIncrease: BillingAttachOnIncrease; + /** + * Credit behavior when quantity decreases mid-cycle. + */ onDecrease: BillingAttachOnDecrease; }; +/** + * When rolled over units expire. + */ export const BillingAttachExpiryDurationType = { Month: "month", Forever: "forever", } as const; +/** + * When rolled over units expire. + */ export type BillingAttachExpiryDurationType = ClosedEnum< typeof BillingAttachExpiryDurationType >; +/** + * Rollover config for unused units. If set, unused included units carry over. + */ export type BillingAttachRollover = { + /** + * Max rollover units. Omit for unlimited rollover. + */ max?: number | undefined; + /** + * When rolled over units expire. + */ expiryDurationType: BillingAttachExpiryDurationType; + /** + * Number of periods before expiry. + */ expiryDurationLength?: number | undefined; }; export type BillingAttachItem = { + /** + * The ID of the feature to configure. + */ featureId: string; + /** + * Number of free units included. Balance resets to this each interval for consumable features. + */ included?: number | undefined; + /** + * If true, customer has unlimited access to this feature. + */ unlimited?: boolean | undefined; + /** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ reset?: BillingAttachReset | undefined; + /** + * Pricing for usage beyond included units. Omit for free features. + */ price?: BillingAttachItemPrice | undefined; + /** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ proration?: BillingAttachProration | undefined; + /** + * Rollover config for unused units. If set, unused included units carry over. + */ rollover?: BillingAttachRollover | undefined; }; diff --git a/packages/sdk/src/models/billing-update-op.ts b/packages/sdk/src/models/billing-update-op.ts index f8402e63d..6fd500004 100644 --- a/packages/sdk/src/models/billing-update-op.ts +++ b/packages/sdk/src/models/billing-update-op.ts @@ -22,21 +22,39 @@ export type BillingUpdateFeatureQuantity = { adjustable?: boolean | undefined; }; +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ export const BillingUpdateDurationType = { Day: "day", Month: "month", Year: "year", } as const; +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ export type BillingUpdateDurationType = ClosedEnum< typeof BillingUpdateDurationType >; export type BillingUpdateFreeTrial = { + /** + * Number of duration_type periods the trial lasts. + */ durationLength: number; + /** + * Unit of time for the trial ('day', 'month', 'year'). + */ durationType?: BillingUpdateDurationType | undefined; + /** + * If true, payment method required to start trial. Customer is charged after trial ends. + */ cardRequired?: boolean | undefined; }; +/** + * Billing interval (e.g. 'month', 'year'). + */ export const BillingUpdatePriceInterval = { OneOff: "one_off", Week: "week", @@ -45,16 +63,31 @@ export const BillingUpdatePriceInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ export type BillingUpdatePriceInterval = ClosedEnum< typeof BillingUpdatePriceInterval >; export type BillingUpdatePrice = { + /** + * Base price amount for the plan. + */ amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ interval: BillingUpdatePriceInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ intervalCount?: number | undefined; }; +/** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ export const BillingUpdateResetInterval = { OneOff: "one_off", Minute: "minute", @@ -66,12 +99,24 @@ export const BillingUpdateResetInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ export type BillingUpdateResetInterval = ClosedEnum< typeof BillingUpdateResetInterval >; +/** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ export type BillingUpdateReset = { + /** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ interval: BillingUpdateResetInterval; + /** + * Number of intervals between resets. Defaults to 1. + */ intervalCount?: number | undefined; }; @@ -82,6 +127,9 @@ export type BillingUpdateTier = { amount: number; }; +/** + * Billing interval. For consumable features, should match reset.interval. + */ export const BillingUpdateItemPriceInterval = { OneOff: "one_off", Week: "week", @@ -90,38 +138,80 @@ export const BillingUpdateItemPriceInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Billing interval. For consumable features, should match reset.interval. + */ export type BillingUpdateItemPriceInterval = ClosedEnum< typeof BillingUpdateItemPriceInterval >; +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ export const BillingUpdateBillingMethod = { Prepaid: "prepaid", UsageBased: "usage_based", } as const; +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ export type BillingUpdateBillingMethod = ClosedEnum< typeof BillingUpdateBillingMethod >; +/** + * Pricing for usage beyond included units. Omit for free features. + */ export type BillingUpdateItemPrice = { + /** + * Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + */ amount?: number | undefined; + /** + * Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + */ tiers?: Array | undefined; + /** + * Billing interval. For consumable features, should match reset.interval. + */ interval: BillingUpdateItemPriceInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ intervalCount?: number | undefined; + /** + * Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + */ billingUnits?: number | undefined; + /** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ billingMethod: BillingUpdateBillingMethod; + /** + * Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + */ maxPurchase?: number | undefined; }; +/** + * Billing behavior when quantity increases mid-cycle. + */ export const BillingUpdateOnIncrease = { BillImmediately: "bill_immediately", ProrateImmediately: "prorate_immediately", ProrateNextCycle: "prorate_next_cycle", BillNextCycle: "bill_next_cycle", } as const; +/** + * Billing behavior when quantity increases mid-cycle. + */ export type BillingUpdateOnIncrease = ClosedEnum< typeof BillingUpdateOnIncrease >; +/** + * Credit behavior when quantity decreases mid-cycle. + */ export const BillingUpdateOnDecrease = { Prorate: "prorate", ProrateImmediately: "prorate_immediately", @@ -129,36 +219,87 @@ export const BillingUpdateOnDecrease = { None: "none", NoProrations: "no_prorations", } as const; +/** + * Credit behavior when quantity decreases mid-cycle. + */ export type BillingUpdateOnDecrease = ClosedEnum< typeof BillingUpdateOnDecrease >; +/** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ export type BillingUpdateProration = { + /** + * Billing behavior when quantity increases mid-cycle. + */ onIncrease: BillingUpdateOnIncrease; + /** + * Credit behavior when quantity decreases mid-cycle. + */ onDecrease: BillingUpdateOnDecrease; }; +/** + * When rolled over units expire. + */ export const BillingUpdateExpiryDurationType = { Month: "month", Forever: "forever", } as const; +/** + * When rolled over units expire. + */ export type BillingUpdateExpiryDurationType = ClosedEnum< typeof BillingUpdateExpiryDurationType >; +/** + * Rollover config for unused units. If set, unused included units carry over. + */ export type BillingUpdateRollover = { + /** + * Max rollover units. Omit for unlimited rollover. + */ max?: number | undefined; + /** + * When rolled over units expire. + */ expiryDurationType: BillingUpdateExpiryDurationType; + /** + * Number of periods before expiry. + */ expiryDurationLength?: number | undefined; }; export type BillingUpdateItem = { + /** + * The ID of the feature to configure. + */ featureId: string; + /** + * Number of free units included. Balance resets to this each interval for consumable features. + */ included?: number | undefined; + /** + * If true, customer has unlimited access to this feature. + */ unlimited?: boolean | undefined; + /** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ reset?: BillingUpdateReset | undefined; + /** + * Pricing for usage beyond included units. Omit for free features. + */ price?: BillingUpdateItemPrice | undefined; + /** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ proration?: BillingUpdateProration | undefined; + /** + * Rollover config for unused units. If set, unused included units carry over. + */ rollover?: BillingUpdateRollover | undefined; }; diff --git a/packages/sdk/src/models/check-op.ts b/packages/sdk/src/models/check-op.ts index ce15f9735..87c347986 100644 --- a/packages/sdk/src/models/check-op.ts +++ b/packages/sdk/src/models/check-op.ts @@ -51,14 +51,14 @@ export type CheckParams = { /** * The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. */ -export const CheckScenario = { +export const Scenario = { UsageLimit: "usage_limit", FeatureFlag: "feature_flag", } as const; /** * The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. */ -export type CheckScenario = OpenEnum; +export type Scenario = OpenEnum; /** * The environment of the product @@ -374,7 +374,7 @@ export type Preview = { /** * The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. */ - scenario: CheckScenario; + scenario: Scenario; /** * A title suitable for displaying in a paywall or upgrade modal. */ @@ -469,10 +469,8 @@ export function checkParamsToJSON(checkParams: CheckParams): string { } /** @internal */ -export const CheckScenario$inboundSchema: z.ZodMiniType< - CheckScenario, - unknown -> = openEnums.inboundSchema(CheckScenario); +export const Scenario$inboundSchema: z.ZodMiniType = + openEnums.inboundSchema(Scenario); /** @internal */ export const CheckEnv$inboundSchema: z.ZodMiniType = @@ -795,7 +793,7 @@ export function productFromJSON( /** @internal */ export const Preview$inboundSchema: z.ZodMiniType = z.pipe( z.object({ - scenario: CheckScenario$inboundSchema, + scenario: Scenario$inboundSchema, title: types.string(), message: types.string(), feature_id: types.string(), diff --git a/packages/sdk/src/models/create-plan-op.ts b/packages/sdk/src/models/create-plan-op.ts new file mode 100644 index 000000000..733c129fd --- /dev/null +++ b/packages/sdk/src/models/create-plan-op.ts @@ -0,0 +1,1572 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { ClosedEnum, OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { smartUnion } from "../types/smart-union.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type CreatePlanGlobals = { + xApiVersion?: string | undefined; +}; + +/** + * Billing interval (e.g. 'month', 'year'). + */ +export const CreatePlanPriceIntervalRequest = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ +export type CreatePlanPriceIntervalRequest = ClosedEnum< + typeof CreatePlanPriceIntervalRequest +>; + +/** + * Base recurring price for the plan. Omit for free or usage-only plans. + */ +export type CreatePlanPriceRequest = { + /** + * Base price amount for the plan. + */ + amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ + interval: CreatePlanPriceIntervalRequest; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ + intervalCount?: number | undefined; +}; + +/** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ +export const CreatePlanResetIntervalRequest = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ +export type CreatePlanResetIntervalRequest = ClosedEnum< + typeof CreatePlanResetIntervalRequest +>; + +/** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ +export type CreatePlanResetRequest = { + /** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ + interval: CreatePlanResetIntervalRequest; + /** + * Number of intervals between resets. Defaults to 1. + */ + intervalCount?: number | undefined; +}; + +export type CreatePlanToRequest = number | string; + +export type CreatePlanTierRequest = { + to: number | string; + amount: number; +}; + +/** + * Billing interval. For consumable features, should match reset.interval. + */ +export const CreatePlanItemPriceIntervalRequest = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval. For consumable features, should match reset.interval. + */ +export type CreatePlanItemPriceIntervalRequest = ClosedEnum< + typeof CreatePlanItemPriceIntervalRequest +>; + +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ +export const CreatePlanBillingMethodRequest = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ +export type CreatePlanBillingMethodRequest = ClosedEnum< + typeof CreatePlanBillingMethodRequest +>; + +/** + * Pricing for usage beyond included units. Omit for free features. + */ +export type CreatePlanItemPriceRequest = { + /** + * Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + */ + amount?: number | undefined; + /** + * Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + */ + tiers?: Array | undefined; + /** + * Billing interval. For consumable features, should match reset.interval. + */ + interval: CreatePlanItemPriceIntervalRequest; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ + intervalCount?: number | undefined; + /** + * Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + */ + billingUnits?: number | undefined; + /** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ + billingMethod: CreatePlanBillingMethodRequest; + /** + * Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + */ + maxPurchase?: number | undefined; +}; + +/** + * Billing behavior when quantity increases mid-cycle. + */ +export const CreatePlanOnIncrease = { + BillImmediately: "bill_immediately", + ProrateImmediately: "prorate_immediately", + ProrateNextCycle: "prorate_next_cycle", + BillNextCycle: "bill_next_cycle", +} as const; +/** + * Billing behavior when quantity increases mid-cycle. + */ +export type CreatePlanOnIncrease = ClosedEnum; + +/** + * Credit behavior when quantity decreases mid-cycle. + */ +export const CreatePlanOnDecrease = { + Prorate: "prorate", + ProrateImmediately: "prorate_immediately", + ProrateNextCycle: "prorate_next_cycle", + None: "none", + NoProrations: "no_prorations", +} as const; +/** + * Credit behavior when quantity decreases mid-cycle. + */ +export type CreatePlanOnDecrease = ClosedEnum; + +/** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ +export type CreatePlanProration = { + /** + * Billing behavior when quantity increases mid-cycle. + */ + onIncrease: CreatePlanOnIncrease; + /** + * Credit behavior when quantity decreases mid-cycle. + */ + onDecrease: CreatePlanOnDecrease; +}; + +/** + * When rolled over units expire. + */ +export const CreatePlanExpiryDurationTypeRequest = { + Month: "month", + Forever: "forever", +} as const; +/** + * When rolled over units expire. + */ +export type CreatePlanExpiryDurationTypeRequest = ClosedEnum< + typeof CreatePlanExpiryDurationTypeRequest +>; + +/** + * Rollover config for unused units. If set, unused included units carry over. + */ +export type CreatePlanRolloverRequest = { + /** + * Max rollover units. Omit for unlimited rollover. + */ + max?: number | undefined; + /** + * When rolled over units expire. + */ + expiryDurationType: CreatePlanExpiryDurationTypeRequest; + /** + * Number of periods before expiry. + */ + expiryDurationLength?: number | undefined; +}; + +export type CreatePlanItemRequest = { + /** + * The ID of the feature to configure. + */ + featureId: string; + /** + * Number of free units included. Balance resets to this each interval for consumable features. + */ + included?: number | undefined; + /** + * If true, customer has unlimited access to this feature. + */ + unlimited?: boolean | undefined; + /** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ + reset?: CreatePlanResetRequest | undefined; + /** + * Pricing for usage beyond included units. Omit for free features. + */ + price?: CreatePlanItemPriceRequest | undefined; + /** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ + proration?: CreatePlanProration | undefined; + /** + * Rollover config for unused units. If set, unused included units carry over. + */ + rollover?: CreatePlanRolloverRequest | undefined; +}; + +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ +export const CreatePlanDurationTypeRequest = { + Day: "day", + Month: "month", + Year: "year", +} as const; +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ +export type CreatePlanDurationTypeRequest = ClosedEnum< + typeof CreatePlanDurationTypeRequest +>; + +/** + * Free trial configuration. Customers can try this plan before being charged. + */ +export type CreatePlanFreeTrialRequest = { + /** + * Number of duration_type periods the trial lasts. + */ + durationLength: number; + /** + * Unit of time for the trial ('day', 'month', 'year'). + */ + durationType?: CreatePlanDurationTypeRequest | undefined; + /** + * If true, payment method required to start trial. Customer is charged after trial ends. + */ + cardRequired?: boolean | undefined; +}; + +export type CreatePlanParams = { + /** + * The ID of the plan to create. + */ + planId: string; + /** + * Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + */ + group?: string | undefined; + /** + * Display name of the plan. + */ + name: string; + /** + * Optional description of the plan. + */ + description?: string | null | undefined; + /** + * If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. + */ + addOn?: boolean | undefined; + /** + * If true, plan is automatically attached when a customer is created. Use for free tiers. + */ + autoEnable?: boolean | undefined; + /** + * Base recurring price for the plan. Omit for free or usage-only plans. + */ + price?: CreatePlanPriceRequest | undefined; + /** + * Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. + */ + items?: Array | undefined; + /** + * Free trial configuration. Customers can try this plan before being charged. + */ + freeTrial?: CreatePlanFreeTrialRequest | undefined; +}; + +/** + * Billing interval (e.g. 'month', 'year'). + */ +export const CreatePlanPriceIntervalResponse = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ +export type CreatePlanPriceIntervalResponse = OpenEnum< + typeof CreatePlanPriceIntervalResponse +>; + +/** + * Display text for showing this price in pricing pages. + */ +export type CreatePlanPriceDisplay = { + /** + * Main display text (e.g. '$10' or '100 messages'). + */ + primaryText: string; + /** + * Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + */ + secondaryText?: string | undefined; +}; + +export type CreatePlanPriceResponse = { + /** + * Base price amount for the plan. + */ + amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ + interval: CreatePlanPriceIntervalResponse; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ + intervalCount?: number | undefined; + /** + * Display text for showing this price in pricing pages. + */ + display?: CreatePlanPriceDisplay | undefined; +}; + +/** + * The type of the feature + */ +export const CreatePlanType = { + Static: "static", + Boolean: "boolean", + SingleUse: "single_use", + ContinuousUse: "continuous_use", + CreditSystem: "credit_system", +} as const; +/** + * The type of the feature + */ +export type CreatePlanType = OpenEnum; + +export type CreatePlanFeatureDisplay = { + /** + * The singular display name for the feature. + */ + singular: string; + /** + * The plural display name for the feature. + */ + plural: string; +}; + +export type CreatePlanCreditSchema = { + /** + * The ID of the metered feature (should be a single_use feature). + */ + meteredFeatureId: string; + /** + * The credit cost of the metered feature. + */ + creditCost: number; +}; + +/** + * The full feature object if expanded. + */ +export type CreatePlanFeature = { + /** + * The ID of the feature, used to refer to it in other API calls like /track or /check. + */ + id: string; + /** + * The name of the feature. + */ + name?: string | null | undefined; + /** + * The type of the feature + */ + type: CreatePlanType; + /** + * Singular and plural display names for the feature. + */ + display?: CreatePlanFeatureDisplay | null | undefined; + /** + * Credit cost schema for credit system features. + */ + creditSchema?: Array | null | undefined; + /** + * Whether or not the feature is archived. + */ + archived?: boolean | null | undefined; +}; + +/** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ +export const CreatePlanResetIntervalResponse = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ +export type CreatePlanResetIntervalResponse = OpenEnum< + typeof CreatePlanResetIntervalResponse +>; + +export type CreatePlanResetResponse = { + /** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ + interval: CreatePlanResetIntervalResponse; + /** + * Number of intervals between resets. Defaults to 1. + */ + intervalCount?: number | undefined; +}; + +export type CreatePlanToResponse = number | string; + +export type CreatePlanTierResponse = { + to: number | string; + amount: number; +}; + +/** + * Billing interval for this price. For consumable features, should match reset.interval. + */ +export const CreatePlanPriceItemIntervalResponse = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval for this price. For consumable features, should match reset.interval. + */ +export type CreatePlanPriceItemIntervalResponse = OpenEnum< + typeof CreatePlanPriceItemIntervalResponse +>; + +/** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ +export const CreatePlanBillingMethodResponse = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +/** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ +export type CreatePlanBillingMethodResponse = OpenEnum< + typeof CreatePlanBillingMethodResponse +>; + +export type CreatePlanItemPriceResponse = { + /** + * Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + */ + amount?: number | undefined; + /** + * Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + */ + tiers?: Array | undefined; + /** + * Billing interval for this price. For consumable features, should match reset.interval. + */ + interval: CreatePlanPriceItemIntervalResponse; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ + intervalCount?: number | undefined; + /** + * Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + */ + billingUnits: number; + /** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ + billingMethod: CreatePlanBillingMethodResponse; + /** + * Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + */ + maxPurchase: number | null; +}; + +/** + * Display text for showing this item in pricing pages. + */ +export type CreatePlanItemDisplay = { + /** + * Main display text (e.g. '$10' or '100 messages'). + */ + primaryText: string; + /** + * Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + */ + secondaryText?: string | undefined; +}; + +/** + * When rolled over units expire. + */ +export const CreatePlanExpiryDurationTypeResponse = { + Month: "month", + Forever: "forever", +} as const; +/** + * When rolled over units expire. + */ +export type CreatePlanExpiryDurationTypeResponse = OpenEnum< + typeof CreatePlanExpiryDurationTypeResponse +>; + +/** + * Rollover configuration for unused units. If set, unused included units roll over to the next period. + */ +export type CreatePlanRolloverResponse = { + /** + * Maximum rollover units. Null for unlimited rollover. + */ + max: number | null; + /** + * When rolled over units expire. + */ + expiryDurationType: CreatePlanExpiryDurationTypeResponse; + /** + * Number of periods before expiry. + */ + expiryDurationLength?: number | undefined; +}; + +export type CreatePlanItemResponse = { + /** + * The ID of the feature this item configures. + */ + featureId: string; + /** + * The full feature object if expanded. + */ + feature?: CreatePlanFeature | undefined; + /** + * Number of free units included. For consumable features, balance resets to this number each interval. + */ + included: number; + /** + * Whether the customer has unlimited access to this feature. + */ + unlimited: boolean; + /** + * Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. + */ + reset: CreatePlanResetResponse | null; + /** + * Pricing configuration for usage beyond included units. Null if feature is entirely free. + */ + price: CreatePlanItemPriceResponse | null; + /** + * Display text for showing this item in pricing pages. + */ + display?: CreatePlanItemDisplay | undefined; + /** + * Rollover configuration for unused units. If set, unused included units roll over to the next period. + */ + rollover?: CreatePlanRolloverResponse | undefined; +}; + +/** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ +export const CreatePlanDurationTypeResponse = { + Day: "day", + Month: "month", + Year: "year", +} as const; +/** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ +export type CreatePlanDurationTypeResponse = OpenEnum< + typeof CreatePlanDurationTypeResponse +>; + +/** + * Free trial configuration. If set, new customers can try this plan before being charged. + */ +export type CreatePlanFreeTrialResponse = { + /** + * Number of duration_type periods the trial lasts. + */ + durationLength: number; + /** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ + durationType: CreatePlanDurationTypeResponse; + /** + * Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + */ + cardRequired: boolean; +}; + +/** + * Environment this plan belongs to ('sandbox' or 'live'). + */ +export const CreatePlanEnv = { + Sandbox: "sandbox", + Live: "live", +} as const; +/** + * Environment this plan belongs to ('sandbox' or 'live'). + */ +export type CreatePlanEnv = OpenEnum; + +/** + * A plan defines a set of features, pricing, and entitlements that can be attached to customers. + */ +export type CreatePlanResponse = { + /** + * Unique identifier for the plan. + */ + id: string; + /** + * Display name of the plan. + */ + name: string; + /** + * Optional description of the plan. + */ + description: string | null; + /** + * Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + */ + group: string | null; + /** + * Version number of the plan. Incremented when plan configuration changes. + */ + version: number; + /** + * Whether this is an add-on plan that can be attached alongside a main plan. + */ + addOn: boolean; + /** + * If true, this plan is automatically attached when a customer is created. Used for free plans. + */ + autoEnable: boolean; + /** + * Base recurring price for the plan. Null for free plans or usage-only plans. + */ + price: CreatePlanPriceResponse | null; + /** + * Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. + */ + items: Array; + /** + * Free trial configuration. If set, new customers can try this plan before being charged. + */ + freeTrial?: CreatePlanFreeTrialResponse | undefined; + /** + * Unix timestamp (ms) when the plan was created. + */ + createdAt: number; + /** + * Environment this plan belongs to ('sandbox' or 'live'). + */ + env: CreatePlanEnv; + /** + * Whether the plan is archived. Archived plans cannot be attached to new customers. + */ + archived: boolean; + /** + * If this is a variant, the ID of the base plan it was created from. + */ + baseVariantId: string | null; +}; + +/** @internal */ +export const CreatePlanPriceIntervalRequest$outboundSchema: z.ZodMiniEnum< + typeof CreatePlanPriceIntervalRequest +> = z.enum(CreatePlanPriceIntervalRequest); + +/** @internal */ +export type CreatePlanPriceRequest$Outbound = { + amount: number; + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const CreatePlanPriceRequest$outboundSchema: z.ZodMiniType< + CreatePlanPriceRequest$Outbound, + CreatePlanPriceRequest +> = z.pipe( + z.object({ + amount: z.number(), + interval: CreatePlanPriceIntervalRequest$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function createPlanPriceRequestToJSON( + createPlanPriceRequest: CreatePlanPriceRequest, +): string { + return JSON.stringify( + CreatePlanPriceRequest$outboundSchema.parse(createPlanPriceRequest), + ); +} + +/** @internal */ +export const CreatePlanResetIntervalRequest$outboundSchema: z.ZodMiniEnum< + typeof CreatePlanResetIntervalRequest +> = z.enum(CreatePlanResetIntervalRequest); + +/** @internal */ +export type CreatePlanResetRequest$Outbound = { + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const CreatePlanResetRequest$outboundSchema: z.ZodMiniType< + CreatePlanResetRequest$Outbound, + CreatePlanResetRequest +> = z.pipe( + z.object({ + interval: CreatePlanResetIntervalRequest$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function createPlanResetRequestToJSON( + createPlanResetRequest: CreatePlanResetRequest, +): string { + return JSON.stringify( + CreatePlanResetRequest$outboundSchema.parse(createPlanResetRequest), + ); +} + +/** @internal */ +export type CreatePlanToRequest$Outbound = number | string; + +/** @internal */ +export const CreatePlanToRequest$outboundSchema: z.ZodMiniType< + CreatePlanToRequest$Outbound, + CreatePlanToRequest +> = smartUnion([z.number(), z.string()]); + +export function createPlanToRequestToJSON( + createPlanToRequest: CreatePlanToRequest, +): string { + return JSON.stringify( + CreatePlanToRequest$outboundSchema.parse(createPlanToRequest), + ); +} + +/** @internal */ +export type CreatePlanTierRequest$Outbound = { + to: number | string; + amount: number; +}; + +/** @internal */ +export const CreatePlanTierRequest$outboundSchema: z.ZodMiniType< + CreatePlanTierRequest$Outbound, + CreatePlanTierRequest +> = z.object({ + to: smartUnion([z.number(), z.string()]), + amount: z.number(), +}); + +export function createPlanTierRequestToJSON( + createPlanTierRequest: CreatePlanTierRequest, +): string { + return JSON.stringify( + CreatePlanTierRequest$outboundSchema.parse(createPlanTierRequest), + ); +} + +/** @internal */ +export const CreatePlanItemPriceIntervalRequest$outboundSchema: z.ZodMiniEnum< + typeof CreatePlanItemPriceIntervalRequest +> = z.enum(CreatePlanItemPriceIntervalRequest); + +/** @internal */ +export const CreatePlanBillingMethodRequest$outboundSchema: z.ZodMiniEnum< + typeof CreatePlanBillingMethodRequest +> = z.enum(CreatePlanBillingMethodRequest); + +/** @internal */ +export type CreatePlanItemPriceRequest$Outbound = { + amount?: number | undefined; + tiers?: Array | undefined; + interval: string; + interval_count: number; + billing_units: number; + billing_method: string; + max_purchase?: number | undefined; +}; + +/** @internal */ +export const CreatePlanItemPriceRequest$outboundSchema: z.ZodMiniType< + CreatePlanItemPriceRequest$Outbound, + CreatePlanItemPriceRequest +> = z.pipe( + z.object({ + amount: z.optional(z.number()), + tiers: z.optional( + z.array(z.lazy(() => CreatePlanTierRequest$outboundSchema)), + ), + interval: CreatePlanItemPriceIntervalRequest$outboundSchema, + intervalCount: z._default(z.number(), 1), + billingUnits: z._default(z.number(), 1), + billingMethod: CreatePlanBillingMethodRequest$outboundSchema, + maxPurchase: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + billingUnits: "billing_units", + billingMethod: "billing_method", + maxPurchase: "max_purchase", + }); + }), +); + +export function createPlanItemPriceRequestToJSON( + createPlanItemPriceRequest: CreatePlanItemPriceRequest, +): string { + return JSON.stringify( + CreatePlanItemPriceRequest$outboundSchema.parse(createPlanItemPriceRequest), + ); +} + +/** @internal */ +export const CreatePlanOnIncrease$outboundSchema: z.ZodMiniEnum< + typeof CreatePlanOnIncrease +> = z.enum(CreatePlanOnIncrease); + +/** @internal */ +export const CreatePlanOnDecrease$outboundSchema: z.ZodMiniEnum< + typeof CreatePlanOnDecrease +> = z.enum(CreatePlanOnDecrease); + +/** @internal */ +export type CreatePlanProration$Outbound = { + on_increase: string; + on_decrease: string; +}; + +/** @internal */ +export const CreatePlanProration$outboundSchema: z.ZodMiniType< + CreatePlanProration$Outbound, + CreatePlanProration +> = z.pipe( + z.object({ + onIncrease: CreatePlanOnIncrease$outboundSchema, + onDecrease: CreatePlanOnDecrease$outboundSchema, + }), + z.transform((v) => { + return remap$(v, { + onIncrease: "on_increase", + onDecrease: "on_decrease", + }); + }), +); + +export function createPlanProrationToJSON( + createPlanProration: CreatePlanProration, +): string { + return JSON.stringify( + CreatePlanProration$outboundSchema.parse(createPlanProration), + ); +} + +/** @internal */ +export const CreatePlanExpiryDurationTypeRequest$outboundSchema: z.ZodMiniEnum< + typeof CreatePlanExpiryDurationTypeRequest +> = z.enum(CreatePlanExpiryDurationTypeRequest); + +/** @internal */ +export type CreatePlanRolloverRequest$Outbound = { + max?: number | undefined; + expiry_duration_type: string; + expiry_duration_length?: number | undefined; +}; + +/** @internal */ +export const CreatePlanRolloverRequest$outboundSchema: z.ZodMiniType< + CreatePlanRolloverRequest$Outbound, + CreatePlanRolloverRequest +> = z.pipe( + z.object({ + max: z.optional(z.number()), + expiryDurationType: CreatePlanExpiryDurationTypeRequest$outboundSchema, + expiryDurationLength: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + expiryDurationType: "expiry_duration_type", + expiryDurationLength: "expiry_duration_length", + }); + }), +); + +export function createPlanRolloverRequestToJSON( + createPlanRolloverRequest: CreatePlanRolloverRequest, +): string { + return JSON.stringify( + CreatePlanRolloverRequest$outboundSchema.parse(createPlanRolloverRequest), + ); +} + +/** @internal */ +export type CreatePlanItemRequest$Outbound = { + feature_id: string; + included?: number | undefined; + unlimited?: boolean | undefined; + reset?: CreatePlanResetRequest$Outbound | undefined; + price?: CreatePlanItemPriceRequest$Outbound | undefined; + proration?: CreatePlanProration$Outbound | undefined; + rollover?: CreatePlanRolloverRequest$Outbound | undefined; +}; + +/** @internal */ +export const CreatePlanItemRequest$outboundSchema: z.ZodMiniType< + CreatePlanItemRequest$Outbound, + CreatePlanItemRequest +> = z.pipe( + z.object({ + featureId: z.string(), + included: z.optional(z.number()), + unlimited: z.optional(z.boolean()), + reset: z.optional(z.lazy(() => CreatePlanResetRequest$outboundSchema)), + price: z.optional(z.lazy(() => CreatePlanItemPriceRequest$outboundSchema)), + proration: z.optional(z.lazy(() => CreatePlanProration$outboundSchema)), + rollover: z.optional( + z.lazy(() => CreatePlanRolloverRequest$outboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function createPlanItemRequestToJSON( + createPlanItemRequest: CreatePlanItemRequest, +): string { + return JSON.stringify( + CreatePlanItemRequest$outboundSchema.parse(createPlanItemRequest), + ); +} + +/** @internal */ +export const CreatePlanDurationTypeRequest$outboundSchema: z.ZodMiniEnum< + typeof CreatePlanDurationTypeRequest +> = z.enum(CreatePlanDurationTypeRequest); + +/** @internal */ +export type CreatePlanFreeTrialRequest$Outbound = { + duration_length: number; + duration_type: string; + card_required: boolean; +}; + +/** @internal */ +export const CreatePlanFreeTrialRequest$outboundSchema: z.ZodMiniType< + CreatePlanFreeTrialRequest$Outbound, + CreatePlanFreeTrialRequest +> = z.pipe( + z.object({ + durationLength: z.number(), + durationType: z._default( + CreatePlanDurationTypeRequest$outboundSchema, + "month", + ), + cardRequired: z._default(z.boolean(), true), + }), + z.transform((v) => { + return remap$(v, { + durationLength: "duration_length", + durationType: "duration_type", + cardRequired: "card_required", + }); + }), +); + +export function createPlanFreeTrialRequestToJSON( + createPlanFreeTrialRequest: CreatePlanFreeTrialRequest, +): string { + return JSON.stringify( + CreatePlanFreeTrialRequest$outboundSchema.parse(createPlanFreeTrialRequest), + ); +} + +/** @internal */ +export type CreatePlanParams$Outbound = { + plan_id: string; + group: string; + name: string; + description?: string | null | undefined; + add_on: boolean; + auto_enable: boolean; + price?: CreatePlanPriceRequest$Outbound | undefined; + items?: Array | undefined; + free_trial?: CreatePlanFreeTrialRequest$Outbound | undefined; +}; + +/** @internal */ +export const CreatePlanParams$outboundSchema: z.ZodMiniType< + CreatePlanParams$Outbound, + CreatePlanParams +> = z.pipe( + z.object({ + planId: z.string(), + group: z._default(z.string(), ""), + name: z.string(), + description: z.optional(z.nullable(z.string())), + addOn: z._default(z.boolean(), false), + autoEnable: z._default(z.boolean(), false), + price: z.optional(z.lazy(() => CreatePlanPriceRequest$outboundSchema)), + items: z.optional( + z.array(z.lazy(() => CreatePlanItemRequest$outboundSchema)), + ), + freeTrial: z.optional( + z.lazy(() => CreatePlanFreeTrialRequest$outboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + planId: "plan_id", + addOn: "add_on", + autoEnable: "auto_enable", + freeTrial: "free_trial", + }); + }), +); + +export function createPlanParamsToJSON( + createPlanParams: CreatePlanParams, +): string { + return JSON.stringify( + CreatePlanParams$outboundSchema.parse(createPlanParams), + ); +} + +/** @internal */ +export const CreatePlanPriceIntervalResponse$inboundSchema: z.ZodMiniType< + CreatePlanPriceIntervalResponse, + unknown +> = openEnums.inboundSchema(CreatePlanPriceIntervalResponse); + +/** @internal */ +export const CreatePlanPriceDisplay$inboundSchema: z.ZodMiniType< + CreatePlanPriceDisplay, + unknown +> = z.pipe( + z.object({ + primary_text: types.string(), + secondary_text: types.optional(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "primary_text": "primaryText", + "secondary_text": "secondaryText", + }); + }), +); + +export function createPlanPriceDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanPriceDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanPriceDisplay' from JSON`, + ); +} + +/** @internal */ +export const CreatePlanPriceResponse$inboundSchema: z.ZodMiniType< + CreatePlanPriceResponse, + unknown +> = z.pipe( + z.object({ + amount: types.number(), + interval: CreatePlanPriceIntervalResponse$inboundSchema, + interval_count: types.optional(types.number()), + display: types.optional(z.lazy(() => CreatePlanPriceDisplay$inboundSchema)), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + }); + }), +); + +export function createPlanPriceResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanPriceResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanPriceResponse' from JSON`, + ); +} + +/** @internal */ +export const CreatePlanType$inboundSchema: z.ZodMiniType< + CreatePlanType, + unknown +> = openEnums.inboundSchema(CreatePlanType); + +/** @internal */ +export const CreatePlanFeatureDisplay$inboundSchema: z.ZodMiniType< + CreatePlanFeatureDisplay, + unknown +> = z.object({ + singular: types.string(), + plural: types.string(), +}); + +export function createPlanFeatureDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanFeatureDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanFeatureDisplay' from JSON`, + ); +} + +/** @internal */ +export const CreatePlanCreditSchema$inboundSchema: z.ZodMiniType< + CreatePlanCreditSchema, + unknown +> = z.pipe( + z.object({ + metered_feature_id: types.string(), + credit_cost: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "metered_feature_id": "meteredFeatureId", + "credit_cost": "creditCost", + }); + }), +); + +export function createPlanCreditSchemaFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanCreditSchema$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanCreditSchema' from JSON`, + ); +} + +/** @internal */ +export const CreatePlanFeature$inboundSchema: z.ZodMiniType< + CreatePlanFeature, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: z.optional(z.nullable(types.string())), + type: CreatePlanType$inboundSchema, + display: z.optional( + z.nullable(z.lazy(() => CreatePlanFeatureDisplay$inboundSchema)), + ), + credit_schema: z.optional( + z.nullable(z.array(z.lazy(() => CreatePlanCreditSchema$inboundSchema))), + ), + archived: z.optional(z.nullable(types.boolean())), + }), + z.transform((v) => { + return remap$(v, { + "credit_schema": "creditSchema", + }); + }), +); + +export function createPlanFeatureFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanFeature$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanFeature' from JSON`, + ); +} + +/** @internal */ +export const CreatePlanResetIntervalResponse$inboundSchema: z.ZodMiniType< + CreatePlanResetIntervalResponse, + unknown +> = openEnums.inboundSchema(CreatePlanResetIntervalResponse); + +/** @internal */ +export const CreatePlanResetResponse$inboundSchema: z.ZodMiniType< + CreatePlanResetResponse, + unknown +> = z.pipe( + z.object({ + interval: CreatePlanResetIntervalResponse$inboundSchema, + interval_count: types.optional(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + }); + }), +); + +export function createPlanResetResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanResetResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanResetResponse' from JSON`, + ); +} + +/** @internal */ +export const CreatePlanToResponse$inboundSchema: z.ZodMiniType< + CreatePlanToResponse, + unknown +> = smartUnion([types.number(), types.string()]); + +export function createPlanToResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanToResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanToResponse' from JSON`, + ); +} + +/** @internal */ +export const CreatePlanTierResponse$inboundSchema: z.ZodMiniType< + CreatePlanTierResponse, + unknown +> = z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), +}); + +export function createPlanTierResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanTierResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanTierResponse' from JSON`, + ); +} + +/** @internal */ +export const CreatePlanPriceItemIntervalResponse$inboundSchema: z.ZodMiniType< + CreatePlanPriceItemIntervalResponse, + unknown +> = openEnums.inboundSchema(CreatePlanPriceItemIntervalResponse); + +/** @internal */ +export const CreatePlanBillingMethodResponse$inboundSchema: z.ZodMiniType< + CreatePlanBillingMethodResponse, + unknown +> = openEnums.inboundSchema(CreatePlanBillingMethodResponse); + +/** @internal */ +export const CreatePlanItemPriceResponse$inboundSchema: z.ZodMiniType< + CreatePlanItemPriceResponse, + unknown +> = z.pipe( + z.object({ + amount: types.optional(types.number()), + tiers: types.optional( + z.array(z.lazy(() => CreatePlanTierResponse$inboundSchema)), + ), + interval: CreatePlanPriceItemIntervalResponse$inboundSchema, + interval_count: types.optional(types.number()), + billing_units: types.number(), + billing_method: CreatePlanBillingMethodResponse$inboundSchema, + max_purchase: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + "billing_units": "billingUnits", + "billing_method": "billingMethod", + "max_purchase": "maxPurchase", + }); + }), +); + +export function createPlanItemPriceResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanItemPriceResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanItemPriceResponse' from JSON`, + ); +} + +/** @internal */ +export const CreatePlanItemDisplay$inboundSchema: z.ZodMiniType< + CreatePlanItemDisplay, + unknown +> = z.pipe( + z.object({ + primary_text: types.string(), + secondary_text: types.optional(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "primary_text": "primaryText", + "secondary_text": "secondaryText", + }); + }), +); + +export function createPlanItemDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanItemDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanItemDisplay' from JSON`, + ); +} + +/** @internal */ +export const CreatePlanExpiryDurationTypeResponse$inboundSchema: z.ZodMiniType< + CreatePlanExpiryDurationTypeResponse, + unknown +> = openEnums.inboundSchema(CreatePlanExpiryDurationTypeResponse); + +/** @internal */ +export const CreatePlanRolloverResponse$inboundSchema: z.ZodMiniType< + CreatePlanRolloverResponse, + unknown +> = z.pipe( + z.object({ + max: types.nullable(types.number()), + expiry_duration_type: CreatePlanExpiryDurationTypeResponse$inboundSchema, + expiry_duration_length: types.optional(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "expiry_duration_type": "expiryDurationType", + "expiry_duration_length": "expiryDurationLength", + }); + }), +); + +export function createPlanRolloverResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanRolloverResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanRolloverResponse' from JSON`, + ); +} + +/** @internal */ +export const CreatePlanItemResponse$inboundSchema: z.ZodMiniType< + CreatePlanItemResponse, + unknown +> = z.pipe( + z.object({ + feature_id: types.string(), + feature: types.optional(z.lazy(() => CreatePlanFeature$inboundSchema)), + included: types.number(), + unlimited: types.boolean(), + reset: types.nullable(z.lazy(() => CreatePlanResetResponse$inboundSchema)), + price: types.nullable( + z.lazy(() => CreatePlanItemPriceResponse$inboundSchema), + ), + display: types.optional(z.lazy(() => CreatePlanItemDisplay$inboundSchema)), + rollover: types.optional( + z.lazy(() => CreatePlanRolloverResponse$inboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + "feature_id": "featureId", + }); + }), +); + +export function createPlanItemResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanItemResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanItemResponse' from JSON`, + ); +} + +/** @internal */ +export const CreatePlanDurationTypeResponse$inboundSchema: z.ZodMiniType< + CreatePlanDurationTypeResponse, + unknown +> = openEnums.inboundSchema(CreatePlanDurationTypeResponse); + +/** @internal */ +export const CreatePlanFreeTrialResponse$inboundSchema: z.ZodMiniType< + CreatePlanFreeTrialResponse, + unknown +> = z.pipe( + z.object({ + duration_length: types.number(), + duration_type: CreatePlanDurationTypeResponse$inboundSchema, + card_required: types.boolean(), + }), + z.transform((v) => { + return remap$(v, { + "duration_length": "durationLength", + "duration_type": "durationType", + "card_required": "cardRequired", + }); + }), +); + +export function createPlanFreeTrialResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanFreeTrialResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanFreeTrialResponse' from JSON`, + ); +} + +/** @internal */ +export const CreatePlanEnv$inboundSchema: z.ZodMiniType< + CreatePlanEnv, + unknown +> = openEnums.inboundSchema(CreatePlanEnv); + +/** @internal */ +export const CreatePlanResponse$inboundSchema: z.ZodMiniType< + CreatePlanResponse, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: types.string(), + description: types.nullable(types.string()), + group: types.nullable(types.string()), + version: types.number(), + add_on: types.boolean(), + auto_enable: types.boolean(), + price: types.nullable(z.lazy(() => CreatePlanPriceResponse$inboundSchema)), + items: z.array(z.lazy(() => CreatePlanItemResponse$inboundSchema)), + free_trial: types.optional( + z.lazy(() => CreatePlanFreeTrialResponse$inboundSchema), + ), + created_at: types.number(), + env: CreatePlanEnv$inboundSchema, + archived: types.boolean(), + base_variant_id: types.nullable(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "add_on": "addOn", + "auto_enable": "autoEnable", + "free_trial": "freeTrial", + "created_at": "createdAt", + "base_variant_id": "baseVariantId", + }); + }), +); + +export function createPlanResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/delete-plan-op.ts b/packages/sdk/src/models/delete-plan-op.ts new file mode 100644 index 000000000..fe9f3ba63 --- /dev/null +++ b/packages/sdk/src/models/delete-plan-op.ts @@ -0,0 +1,81 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type DeletePlanGlobals = { + xApiVersion?: string | undefined; +}; + +export type DeletePlanParams = { + /** + * The ID of the plan to delete. + */ + planId: string; + /** + * If true, deletes all versions of the plan. Otherwise, only deletes the latest version. + */ + allVersions?: boolean | undefined; +}; + +/** + * OK + */ +export type DeletePlanResponse = { + success: boolean; +}; + +/** @internal */ +export type DeletePlanParams$Outbound = { + plan_id: string; + all_versions: boolean; +}; + +/** @internal */ +export const DeletePlanParams$outboundSchema: z.ZodMiniType< + DeletePlanParams$Outbound, + DeletePlanParams +> = z.pipe( + z.object({ + planId: z.string(), + allVersions: z._default(z.boolean(), false), + }), + z.transform((v) => { + return remap$(v, { + planId: "plan_id", + allVersions: "all_versions", + }); + }), +); + +export function deletePlanParamsToJSON( + deletePlanParams: DeletePlanParams, +): string { + return JSON.stringify( + DeletePlanParams$outboundSchema.parse(deletePlanParams), + ); +} + +/** @internal */ +export const DeletePlanResponse$inboundSchema: z.ZodMiniType< + DeletePlanResponse, + unknown +> = z.object({ + success: types.boolean(), +}); + +export function deletePlanResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DeletePlanResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DeletePlanResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/get-plan-op.ts b/packages/sdk/src/models/get-plan-op.ts new file mode 100644 index 000000000..7379a7233 --- /dev/null +++ b/packages/sdk/src/models/get-plan-op.ts @@ -0,0 +1,876 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { smartUnion } from "../types/smart-union.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type GetPlanGlobals = { + xApiVersion?: string | undefined; +}; + +export type GetPlanParams = { + /** + * The ID of the plan to retrieve. + */ + planId: string; + /** + * The version of the plan to get. Defaults to the latest version. + */ + version?: number | undefined; +}; + +/** + * Billing interval (e.g. 'month', 'year'). + */ +export const GetPlanPriceInterval = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ +export type GetPlanPriceInterval = OpenEnum; + +/** + * Display text for showing this price in pricing pages. + */ +export type GetPlanPriceDisplay = { + /** + * Main display text (e.g. '$10' or '100 messages'). + */ + primaryText: string; + /** + * Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + */ + secondaryText?: string | undefined; +}; + +export type GetPlanPrice = { + /** + * Base price amount for the plan. + */ + amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ + interval: GetPlanPriceInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ + intervalCount?: number | undefined; + /** + * Display text for showing this price in pricing pages. + */ + display?: GetPlanPriceDisplay | undefined; +}; + +/** + * The type of the feature + */ +export const GetPlanType = { + Static: "static", + Boolean: "boolean", + SingleUse: "single_use", + ContinuousUse: "continuous_use", + CreditSystem: "credit_system", +} as const; +/** + * The type of the feature + */ +export type GetPlanType = OpenEnum; + +export type GetPlanFeatureDisplay = { + /** + * The singular display name for the feature. + */ + singular: string; + /** + * The plural display name for the feature. + */ + plural: string; +}; + +export type GetPlanCreditSchema = { + /** + * The ID of the metered feature (should be a single_use feature). + */ + meteredFeatureId: string; + /** + * The credit cost of the metered feature. + */ + creditCost: number; +}; + +/** + * The full feature object if expanded. + */ +export type GetPlanFeature = { + /** + * The ID of the feature, used to refer to it in other API calls like /track or /check. + */ + id: string; + /** + * The name of the feature. + */ + name?: string | null | undefined; + /** + * The type of the feature + */ + type: GetPlanType; + /** + * Singular and plural display names for the feature. + */ + display?: GetPlanFeatureDisplay | null | undefined; + /** + * Credit cost schema for credit system features. + */ + creditSchema?: Array | null | undefined; + /** + * Whether or not the feature is archived. + */ + archived?: boolean | null | undefined; +}; + +/** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ +export const GetPlanResetInterval = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ +export type GetPlanResetInterval = OpenEnum; + +export type GetPlanReset = { + /** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ + interval: GetPlanResetInterval; + /** + * Number of intervals between resets. Defaults to 1. + */ + intervalCount?: number | undefined; +}; + +export type GetPlanTo = number | string; + +export type GetPlanTier = { + to: number | string; + amount: number; +}; + +/** + * Billing interval for this price. For consumable features, should match reset.interval. + */ +export const GetPlanPriceItemInterval = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval for this price. For consumable features, should match reset.interval. + */ +export type GetPlanPriceItemInterval = OpenEnum< + typeof GetPlanPriceItemInterval +>; + +/** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ +export const GetPlanBillingMethod = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +/** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ +export type GetPlanBillingMethod = OpenEnum; + +export type GetPlanItemPrice = { + /** + * Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + */ + amount?: number | undefined; + /** + * Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + */ + tiers?: Array | undefined; + /** + * Billing interval for this price. For consumable features, should match reset.interval. + */ + interval: GetPlanPriceItemInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ + intervalCount?: number | undefined; + /** + * Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + */ + billingUnits: number; + /** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ + billingMethod: GetPlanBillingMethod; + /** + * Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + */ + maxPurchase: number | null; +}; + +/** + * Display text for showing this item in pricing pages. + */ +export type GetPlanItemDisplay = { + /** + * Main display text (e.g. '$10' or '100 messages'). + */ + primaryText: string; + /** + * Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + */ + secondaryText?: string | undefined; +}; + +/** + * When rolled over units expire. + */ +export const GetPlanExpiryDurationType = { + Month: "month", + Forever: "forever", +} as const; +/** + * When rolled over units expire. + */ +export type GetPlanExpiryDurationType = OpenEnum< + typeof GetPlanExpiryDurationType +>; + +/** + * Rollover configuration for unused units. If set, unused included units roll over to the next period. + */ +export type GetPlanRollover = { + /** + * Maximum rollover units. Null for unlimited rollover. + */ + max: number | null; + /** + * When rolled over units expire. + */ + expiryDurationType: GetPlanExpiryDurationType; + /** + * Number of periods before expiry. + */ + expiryDurationLength?: number | undefined; +}; + +export type GetPlanItem = { + /** + * The ID of the feature this item configures. + */ + featureId: string; + /** + * The full feature object if expanded. + */ + feature?: GetPlanFeature | undefined; + /** + * Number of free units included. For consumable features, balance resets to this number each interval. + */ + included: number; + /** + * Whether the customer has unlimited access to this feature. + */ + unlimited: boolean; + /** + * Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. + */ + reset: GetPlanReset | null; + /** + * Pricing configuration for usage beyond included units. Null if feature is entirely free. + */ + price: GetPlanItemPrice | null; + /** + * Display text for showing this item in pricing pages. + */ + display?: GetPlanItemDisplay | undefined; + /** + * Rollover configuration for unused units. If set, unused included units roll over to the next period. + */ + rollover?: GetPlanRollover | undefined; +}; + +/** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ +export const GetPlanDurationType = { + Day: "day", + Month: "month", + Year: "year", +} as const; +/** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ +export type GetPlanDurationType = OpenEnum; + +/** + * Free trial configuration. If set, new customers can try this plan before being charged. + */ +export type GetPlanFreeTrial = { + /** + * Number of duration_type periods the trial lasts. + */ + durationLength: number; + /** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ + durationType: GetPlanDurationType; + /** + * Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + */ + cardRequired: boolean; +}; + +/** + * Environment this plan belongs to ('sandbox' or 'live'). + */ +export const GetPlanEnv = { + Sandbox: "sandbox", + Live: "live", +} as const; +/** + * Environment this plan belongs to ('sandbox' or 'live'). + */ +export type GetPlanEnv = OpenEnum; + +/** + * A plan defines a set of features, pricing, and entitlements that can be attached to customers. + */ +export type GetPlanResponse = { + /** + * Unique identifier for the plan. + */ + id: string; + /** + * Display name of the plan. + */ + name: string; + /** + * Optional description of the plan. + */ + description: string | null; + /** + * Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + */ + group: string | null; + /** + * Version number of the plan. Incremented when plan configuration changes. + */ + version: number; + /** + * Whether this is an add-on plan that can be attached alongside a main plan. + */ + addOn: boolean; + /** + * If true, this plan is automatically attached when a customer is created. Used for free plans. + */ + autoEnable: boolean; + /** + * Base recurring price for the plan. Null for free plans or usage-only plans. + */ + price: GetPlanPrice | null; + /** + * Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. + */ + items: Array; + /** + * Free trial configuration. If set, new customers can try this plan before being charged. + */ + freeTrial?: GetPlanFreeTrial | undefined; + /** + * Unix timestamp (ms) when the plan was created. + */ + createdAt: number; + /** + * Environment this plan belongs to ('sandbox' or 'live'). + */ + env: GetPlanEnv; + /** + * Whether the plan is archived. Archived plans cannot be attached to new customers. + */ + archived: boolean; + /** + * If this is a variant, the ID of the base plan it was created from. + */ + baseVariantId: string | null; +}; + +/** @internal */ +export type GetPlanParams$Outbound = { + plan_id: string; + version?: number | undefined; +}; + +/** @internal */ +export const GetPlanParams$outboundSchema: z.ZodMiniType< + GetPlanParams$Outbound, + GetPlanParams +> = z.pipe( + z.object({ + planId: z.string(), + version: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + planId: "plan_id", + }); + }), +); + +export function getPlanParamsToJSON(getPlanParams: GetPlanParams): string { + return JSON.stringify(GetPlanParams$outboundSchema.parse(getPlanParams)); +} + +/** @internal */ +export const GetPlanPriceInterval$inboundSchema: z.ZodMiniType< + GetPlanPriceInterval, + unknown +> = openEnums.inboundSchema(GetPlanPriceInterval); + +/** @internal */ +export const GetPlanPriceDisplay$inboundSchema: z.ZodMiniType< + GetPlanPriceDisplay, + unknown +> = z.pipe( + z.object({ + primary_text: types.string(), + secondary_text: types.optional(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "primary_text": "primaryText", + "secondary_text": "secondaryText", + }); + }), +); + +export function getPlanPriceDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanPriceDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanPriceDisplay' from JSON`, + ); +} + +/** @internal */ +export const GetPlanPrice$inboundSchema: z.ZodMiniType = + z.pipe( + z.object({ + amount: types.number(), + interval: GetPlanPriceInterval$inboundSchema, + interval_count: types.optional(types.number()), + display: types.optional(z.lazy(() => GetPlanPriceDisplay$inboundSchema)), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + }); + }), + ); + +export function getPlanPriceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanPrice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanPrice' from JSON`, + ); +} + +/** @internal */ +export const GetPlanType$inboundSchema: z.ZodMiniType = + openEnums.inboundSchema(GetPlanType); + +/** @internal */ +export const GetPlanFeatureDisplay$inboundSchema: z.ZodMiniType< + GetPlanFeatureDisplay, + unknown +> = z.object({ + singular: types.string(), + plural: types.string(), +}); + +export function getPlanFeatureDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanFeatureDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanFeatureDisplay' from JSON`, + ); +} + +/** @internal */ +export const GetPlanCreditSchema$inboundSchema: z.ZodMiniType< + GetPlanCreditSchema, + unknown +> = z.pipe( + z.object({ + metered_feature_id: types.string(), + credit_cost: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "metered_feature_id": "meteredFeatureId", + "credit_cost": "creditCost", + }); + }), +); + +export function getPlanCreditSchemaFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanCreditSchema$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanCreditSchema' from JSON`, + ); +} + +/** @internal */ +export const GetPlanFeature$inboundSchema: z.ZodMiniType< + GetPlanFeature, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: z.optional(z.nullable(types.string())), + type: GetPlanType$inboundSchema, + display: z.optional( + z.nullable(z.lazy(() => GetPlanFeatureDisplay$inboundSchema)), + ), + credit_schema: z.optional( + z.nullable(z.array(z.lazy(() => GetPlanCreditSchema$inboundSchema))), + ), + archived: z.optional(z.nullable(types.boolean())), + }), + z.transform((v) => { + return remap$(v, { + "credit_schema": "creditSchema", + }); + }), +); + +export function getPlanFeatureFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanFeature$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanFeature' from JSON`, + ); +} + +/** @internal */ +export const GetPlanResetInterval$inboundSchema: z.ZodMiniType< + GetPlanResetInterval, + unknown +> = openEnums.inboundSchema(GetPlanResetInterval); + +/** @internal */ +export const GetPlanReset$inboundSchema: z.ZodMiniType = + z.pipe( + z.object({ + interval: GetPlanResetInterval$inboundSchema, + interval_count: types.optional(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + }); + }), + ); + +export function getPlanResetFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanReset$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanReset' from JSON`, + ); +} + +/** @internal */ +export const GetPlanTo$inboundSchema: z.ZodMiniType = + smartUnion([types.number(), types.string()]); + +export function getPlanToFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanTo$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanTo' from JSON`, + ); +} + +/** @internal */ +export const GetPlanTier$inboundSchema: z.ZodMiniType = z + .object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), + }); + +export function getPlanTierFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanTier$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanTier' from JSON`, + ); +} + +/** @internal */ +export const GetPlanPriceItemInterval$inboundSchema: z.ZodMiniType< + GetPlanPriceItemInterval, + unknown +> = openEnums.inboundSchema(GetPlanPriceItemInterval); + +/** @internal */ +export const GetPlanBillingMethod$inboundSchema: z.ZodMiniType< + GetPlanBillingMethod, + unknown +> = openEnums.inboundSchema(GetPlanBillingMethod); + +/** @internal */ +export const GetPlanItemPrice$inboundSchema: z.ZodMiniType< + GetPlanItemPrice, + unknown +> = z.pipe( + z.object({ + amount: types.optional(types.number()), + tiers: types.optional(z.array(z.lazy(() => GetPlanTier$inboundSchema))), + interval: GetPlanPriceItemInterval$inboundSchema, + interval_count: types.optional(types.number()), + billing_units: types.number(), + billing_method: GetPlanBillingMethod$inboundSchema, + max_purchase: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + "billing_units": "billingUnits", + "billing_method": "billingMethod", + "max_purchase": "maxPurchase", + }); + }), +); + +export function getPlanItemPriceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanItemPrice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanItemPrice' from JSON`, + ); +} + +/** @internal */ +export const GetPlanItemDisplay$inboundSchema: z.ZodMiniType< + GetPlanItemDisplay, + unknown +> = z.pipe( + z.object({ + primary_text: types.string(), + secondary_text: types.optional(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "primary_text": "primaryText", + "secondary_text": "secondaryText", + }); + }), +); + +export function getPlanItemDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanItemDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanItemDisplay' from JSON`, + ); +} + +/** @internal */ +export const GetPlanExpiryDurationType$inboundSchema: z.ZodMiniType< + GetPlanExpiryDurationType, + unknown +> = openEnums.inboundSchema(GetPlanExpiryDurationType); + +/** @internal */ +export const GetPlanRollover$inboundSchema: z.ZodMiniType< + GetPlanRollover, + unknown +> = z.pipe( + z.object({ + max: types.nullable(types.number()), + expiry_duration_type: GetPlanExpiryDurationType$inboundSchema, + expiry_duration_length: types.optional(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "expiry_duration_type": "expiryDurationType", + "expiry_duration_length": "expiryDurationLength", + }); + }), +); + +export function getPlanRolloverFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanRollover$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanRollover' from JSON`, + ); +} + +/** @internal */ +export const GetPlanItem$inboundSchema: z.ZodMiniType = z + .pipe( + z.object({ + feature_id: types.string(), + feature: types.optional(z.lazy(() => GetPlanFeature$inboundSchema)), + included: types.number(), + unlimited: types.boolean(), + reset: types.nullable(z.lazy(() => GetPlanReset$inboundSchema)), + price: types.nullable(z.lazy(() => GetPlanItemPrice$inboundSchema)), + display: types.optional(z.lazy(() => GetPlanItemDisplay$inboundSchema)), + rollover: types.optional(z.lazy(() => GetPlanRollover$inboundSchema)), + }), + z.transform((v) => { + return remap$(v, { + "feature_id": "featureId", + }); + }), + ); + +export function getPlanItemFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanItem$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanItem' from JSON`, + ); +} + +/** @internal */ +export const GetPlanDurationType$inboundSchema: z.ZodMiniType< + GetPlanDurationType, + unknown +> = openEnums.inboundSchema(GetPlanDurationType); + +/** @internal */ +export const GetPlanFreeTrial$inboundSchema: z.ZodMiniType< + GetPlanFreeTrial, + unknown +> = z.pipe( + z.object({ + duration_length: types.number(), + duration_type: GetPlanDurationType$inboundSchema, + card_required: types.boolean(), + }), + z.transform((v) => { + return remap$(v, { + "duration_length": "durationLength", + "duration_type": "durationType", + "card_required": "cardRequired", + }); + }), +); + +export function getPlanFreeTrialFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanFreeTrial$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanFreeTrial' from JSON`, + ); +} + +/** @internal */ +export const GetPlanEnv$inboundSchema: z.ZodMiniType = + openEnums.inboundSchema(GetPlanEnv); + +/** @internal */ +export const GetPlanResponse$inboundSchema: z.ZodMiniType< + GetPlanResponse, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: types.string(), + description: types.nullable(types.string()), + group: types.nullable(types.string()), + version: types.number(), + add_on: types.boolean(), + auto_enable: types.boolean(), + price: types.nullable(z.lazy(() => GetPlanPrice$inboundSchema)), + items: z.array(z.lazy(() => GetPlanItem$inboundSchema)), + free_trial: types.optional(z.lazy(() => GetPlanFreeTrial$inboundSchema)), + created_at: types.number(), + env: GetPlanEnv$inboundSchema, + archived: types.boolean(), + base_variant_id: types.nullable(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "add_on": "addOn", + "auto_enable": "autoEnable", + "free_trial": "freeTrial", + "created_at": "createdAt", + "base_variant_id": "baseVariantId", + }); + }), +); + +export function getPlanResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/index.ts b/packages/sdk/src/models/index.ts index d896b711a..bf70667b0 100644 --- a/packages/sdk/src/models/index.ts +++ b/packages/sdk/src/models/index.ts @@ -12,6 +12,7 @@ export * from "./check-op.js"; export * from "./create-balance-op.js"; export * from "./create-entity-op.js"; export * from "./create-feature-op.js"; +export * from "./create-plan-op.js"; export * from "./create-referral-code-op.js"; export * from "./customer-data.js"; export * from "./customer-expand.js"; @@ -19,9 +20,11 @@ export * from "./customer.js"; export * from "./delete-customer-op.js"; export * from "./delete-entity-op.js"; export * from "./delete-feature-op.js"; +export * from "./delete-plan-op.js"; export * from "./get-entity-op.js"; export * from "./get-feature-op.js"; export * from "./get-or-create-customer-op.js"; +export * from "./get-plan-op.js"; export * from "./http-client-errors.js"; export * from "./list-customers-op.js"; export * from "./list-events-op.js"; @@ -35,7 +38,9 @@ export * from "./redeem-referral-code-op.js"; export * from "./response-validation-error.js"; export * from "./sdk-validation-error.js"; export * from "./security.js"; +export * from "./setup-payment-op.js"; export * from "./track-op.js"; export * from "./update-balance-op.js"; export * from "./update-customer-op.js"; export * from "./update-feature-op.js"; +export * from "./update-plan-op.js"; diff --git a/packages/sdk/src/models/list-plans-op.ts b/packages/sdk/src/models/list-plans-op.ts index 47f493799..7d208a676 100644 --- a/packages/sdk/src/models/list-plans-op.ts +++ b/packages/sdk/src/models/list-plans-op.ts @@ -5,38 +5,450 @@ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; -import { Plan, Plan$inboundSchema } from "./plan.js"; +import * as types from "../types/primitives.js"; +import { smartUnion } from "../types/smart-union.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type ListPlansGlobals = { xApiVersion?: string | undefined; }; -export type ListPlansRequest = { +export type ListPlansParams = { + /** + * Customer ID to include eligibility info (trial availability, attach scenario). + */ customerId?: string | undefined; + /** + * Entity ID for entity-scoped plans. + */ entityId?: string | undefined; + /** + * If true, includes archived plans in the response. + */ includeArchived?: boolean | undefined; }; +/** + * Billing interval (e.g. 'month', 'year'). + */ +export const ListPlansPriceInterval = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ +export type ListPlansPriceInterval = OpenEnum; + +/** + * Display text for showing this price in pricing pages. + */ +export type ListPlansPriceDisplay = { + /** + * Main display text (e.g. '$10' or '100 messages'). + */ + primaryText: string; + /** + * Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + */ + secondaryText?: string | undefined; +}; + +export type ListPlansPrice = { + /** + * Base price amount for the plan. + */ + amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ + interval: ListPlansPriceInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ + intervalCount?: number | undefined; + /** + * Display text for showing this price in pricing pages. + */ + display?: ListPlansPriceDisplay | undefined; +}; + +/** + * The type of the feature + */ +export const ListPlansType = { + Static: "static", + Boolean: "boolean", + SingleUse: "single_use", + ContinuousUse: "continuous_use", + CreditSystem: "credit_system", +} as const; +/** + * The type of the feature + */ +export type ListPlansType = OpenEnum; + +export type ListPlansFeatureDisplay = { + /** + * The singular display name for the feature. + */ + singular: string; + /** + * The plural display name for the feature. + */ + plural: string; +}; + +export type ListPlansCreditSchema = { + /** + * The ID of the metered feature (should be a single_use feature). + */ + meteredFeatureId: string; + /** + * The credit cost of the metered feature. + */ + creditCost: number; +}; + +/** + * The full feature object if expanded. + */ +export type ListPlansFeature = { + /** + * The ID of the feature, used to refer to it in other API calls like /track or /check. + */ + id: string; + /** + * The name of the feature. + */ + name?: string | null | undefined; + /** + * The type of the feature + */ + type: ListPlansType; + /** + * Singular and plural display names for the feature. + */ + display?: ListPlansFeatureDisplay | null | undefined; + /** + * Credit cost schema for credit system features. + */ + creditSchema?: Array | null | undefined; + /** + * Whether or not the feature is archived. + */ + archived?: boolean | null | undefined; +}; + +/** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ +export const ListPlansResetInterval = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ +export type ListPlansResetInterval = OpenEnum; + +export type ListPlansReset = { + /** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ + interval: ListPlansResetInterval; + /** + * Number of intervals between resets. Defaults to 1. + */ + intervalCount?: number | undefined; +}; + +export type ListPlansTo = number | string; + +export type ListPlansTier = { + to: number | string; + amount: number; +}; + +/** + * Billing interval for this price. For consumable features, should match reset.interval. + */ +export const ListPlansPriceItemInterval = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval for this price. For consumable features, should match reset.interval. + */ +export type ListPlansPriceItemInterval = OpenEnum< + typeof ListPlansPriceItemInterval +>; + +/** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ +export const ListPlansBillingMethod = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +/** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ +export type ListPlansBillingMethod = OpenEnum; + +export type ListPlansItemPrice = { + /** + * Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + */ + amount?: number | undefined; + /** + * Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + */ + tiers?: Array | undefined; + /** + * Billing interval for this price. For consumable features, should match reset.interval. + */ + interval: ListPlansPriceItemInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ + intervalCount?: number | undefined; + /** + * Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + */ + billingUnits: number; + /** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ + billingMethod: ListPlansBillingMethod; + /** + * Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + */ + maxPurchase: number | null; +}; + +/** + * Display text for showing this item in pricing pages. + */ +export type ListPlansItemDisplay = { + /** + * Main display text (e.g. '$10' or '100 messages'). + */ + primaryText: string; + /** + * Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + */ + secondaryText?: string | undefined; +}; + +/** + * When rolled over units expire. + */ +export const ListPlansExpiryDurationType = { + Month: "month", + Forever: "forever", +} as const; +/** + * When rolled over units expire. + */ +export type ListPlansExpiryDurationType = OpenEnum< + typeof ListPlansExpiryDurationType +>; + +/** + * Rollover configuration for unused units. If set, unused included units roll over to the next period. + */ +export type ListPlansRollover = { + /** + * Maximum rollover units. Null for unlimited rollover. + */ + max: number | null; + /** + * When rolled over units expire. + */ + expiryDurationType: ListPlansExpiryDurationType; + /** + * Number of periods before expiry. + */ + expiryDurationLength?: number | undefined; +}; + +export type ListPlansItem = { + /** + * The ID of the feature this item configures. + */ + featureId: string; + /** + * The full feature object if expanded. + */ + feature?: ListPlansFeature | undefined; + /** + * Number of free units included. For consumable features, balance resets to this number each interval. + */ + included: number; + /** + * Whether the customer has unlimited access to this feature. + */ + unlimited: boolean; + /** + * Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. + */ + reset: ListPlansReset | null; + /** + * Pricing configuration for usage beyond included units. Null if feature is entirely free. + */ + price: ListPlansItemPrice | null; + /** + * Display text for showing this item in pricing pages. + */ + display?: ListPlansItemDisplay | undefined; + /** + * Rollover configuration for unused units. If set, unused included units roll over to the next period. + */ + rollover?: ListPlansRollover | undefined; +}; + +/** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ +export const ListPlansDurationType = { + Day: "day", + Month: "month", + Year: "year", +} as const; +/** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ +export type ListPlansDurationType = OpenEnum; + +/** + * Free trial configuration. If set, new customers can try this plan before being charged. + */ +export type ListPlansFreeTrial = { + /** + * Number of duration_type periods the trial lasts. + */ + durationLength: number; + /** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ + durationType: ListPlansDurationType; + /** + * Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + */ + cardRequired: boolean; +}; + +/** + * Environment this plan belongs to ('sandbox' or 'live'). + */ +export const ListPlansEnv = { + Sandbox: "sandbox", + Live: "live", +} as const; +/** + * Environment this plan belongs to ('sandbox' or 'live'). + */ +export type ListPlansEnv = OpenEnum; + +/** + * A plan defines a set of features, pricing, and entitlements that can be attached to customers. + */ +export type ListPlansList = { + /** + * Unique identifier for the plan. + */ + id: string; + /** + * Display name of the plan. + */ + name: string; + /** + * Optional description of the plan. + */ + description: string | null; + /** + * Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + */ + group: string | null; + /** + * Version number of the plan. Incremented when plan configuration changes. + */ + version: number; + /** + * Whether this is an add-on plan that can be attached alongside a main plan. + */ + addOn: boolean; + /** + * If true, this plan is automatically attached when a customer is created. Used for free plans. + */ + autoEnable: boolean; + /** + * Base recurring price for the plan. Null for free plans or usage-only plans. + */ + price: ListPlansPrice | null; + /** + * Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. + */ + items: Array; + /** + * Free trial configuration. If set, new customers can try this plan before being charged. + */ + freeTrial?: ListPlansFreeTrial | undefined; + /** + * Unix timestamp (ms) when the plan was created. + */ + createdAt: number; + /** + * Environment this plan belongs to ('sandbox' or 'live'). + */ + env: ListPlansEnv; + /** + * Whether the plan is archived. Archived plans cannot be attached to new customers. + */ + archived: boolean; + /** + * If this is a variant, the ID of the base plan it was created from. + */ + baseVariantId: string | null; +}; + /** * OK */ export type ListPlansResponse = { - list: Array; + list: Array; }; /** @internal */ -export type ListPlansRequest$Outbound = { +export type ListPlansParams$Outbound = { customer_id?: string | undefined; entity_id?: string | undefined; include_archived?: boolean | undefined; }; /** @internal */ -export const ListPlansRequest$outboundSchema: z.ZodMiniType< - ListPlansRequest$Outbound, - ListPlansRequest +export const ListPlansParams$outboundSchema: z.ZodMiniType< + ListPlansParams$Outbound, + ListPlansParams > = z.pipe( z.object({ customerId: z.optional(z.string()), @@ -52,11 +464,441 @@ export const ListPlansRequest$outboundSchema: z.ZodMiniType< }), ); -export function listPlansRequestToJSON( - listPlansRequest: ListPlansRequest, +export function listPlansParamsToJSON( + listPlansParams: ListPlansParams, ): string { - return JSON.stringify( - ListPlansRequest$outboundSchema.parse(listPlansRequest), + return JSON.stringify(ListPlansParams$outboundSchema.parse(listPlansParams)); +} + +/** @internal */ +export const ListPlansPriceInterval$inboundSchema: z.ZodMiniType< + ListPlansPriceInterval, + unknown +> = openEnums.inboundSchema(ListPlansPriceInterval); + +/** @internal */ +export const ListPlansPriceDisplay$inboundSchema: z.ZodMiniType< + ListPlansPriceDisplay, + unknown +> = z.pipe( + z.object({ + primary_text: types.string(), + secondary_text: types.optional(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "primary_text": "primaryText", + "secondary_text": "secondaryText", + }); + }), +); + +export function listPlansPriceDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansPriceDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansPriceDisplay' from JSON`, + ); +} + +/** @internal */ +export const ListPlansPrice$inboundSchema: z.ZodMiniType< + ListPlansPrice, + unknown +> = z.pipe( + z.object({ + amount: types.number(), + interval: ListPlansPriceInterval$inboundSchema, + interval_count: types.optional(types.number()), + display: types.optional(z.lazy(() => ListPlansPriceDisplay$inboundSchema)), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + }); + }), +); + +export function listPlansPriceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansPrice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansPrice' from JSON`, + ); +} + +/** @internal */ +export const ListPlansType$inboundSchema: z.ZodMiniType< + ListPlansType, + unknown +> = openEnums.inboundSchema(ListPlansType); + +/** @internal */ +export const ListPlansFeatureDisplay$inboundSchema: z.ZodMiniType< + ListPlansFeatureDisplay, + unknown +> = z.object({ + singular: types.string(), + plural: types.string(), +}); + +export function listPlansFeatureDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansFeatureDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansFeatureDisplay' from JSON`, + ); +} + +/** @internal */ +export const ListPlansCreditSchema$inboundSchema: z.ZodMiniType< + ListPlansCreditSchema, + unknown +> = z.pipe( + z.object({ + metered_feature_id: types.string(), + credit_cost: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "metered_feature_id": "meteredFeatureId", + "credit_cost": "creditCost", + }); + }), +); + +export function listPlansCreditSchemaFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansCreditSchema$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansCreditSchema' from JSON`, + ); +} + +/** @internal */ +export const ListPlansFeature$inboundSchema: z.ZodMiniType< + ListPlansFeature, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: z.optional(z.nullable(types.string())), + type: ListPlansType$inboundSchema, + display: z.optional( + z.nullable(z.lazy(() => ListPlansFeatureDisplay$inboundSchema)), + ), + credit_schema: z.optional( + z.nullable(z.array(z.lazy(() => ListPlansCreditSchema$inboundSchema))), + ), + archived: z.optional(z.nullable(types.boolean())), + }), + z.transform((v) => { + return remap$(v, { + "credit_schema": "creditSchema", + }); + }), +); + +export function listPlansFeatureFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansFeature$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansFeature' from JSON`, + ); +} + +/** @internal */ +export const ListPlansResetInterval$inboundSchema: z.ZodMiniType< + ListPlansResetInterval, + unknown +> = openEnums.inboundSchema(ListPlansResetInterval); + +/** @internal */ +export const ListPlansReset$inboundSchema: z.ZodMiniType< + ListPlansReset, + unknown +> = z.pipe( + z.object({ + interval: ListPlansResetInterval$inboundSchema, + interval_count: types.optional(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + }); + }), +); + +export function listPlansResetFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansReset$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansReset' from JSON`, + ); +} + +/** @internal */ +export const ListPlansTo$inboundSchema: z.ZodMiniType = + smartUnion([types.number(), types.string()]); + +export function listPlansToFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansTo$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansTo' from JSON`, + ); +} + +/** @internal */ +export const ListPlansTier$inboundSchema: z.ZodMiniType< + ListPlansTier, + unknown +> = z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), +}); + +export function listPlansTierFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansTier$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansTier' from JSON`, + ); +} + +/** @internal */ +export const ListPlansPriceItemInterval$inboundSchema: z.ZodMiniType< + ListPlansPriceItemInterval, + unknown +> = openEnums.inboundSchema(ListPlansPriceItemInterval); + +/** @internal */ +export const ListPlansBillingMethod$inboundSchema: z.ZodMiniType< + ListPlansBillingMethod, + unknown +> = openEnums.inboundSchema(ListPlansBillingMethod); + +/** @internal */ +export const ListPlansItemPrice$inboundSchema: z.ZodMiniType< + ListPlansItemPrice, + unknown +> = z.pipe( + z.object({ + amount: types.optional(types.number()), + tiers: types.optional(z.array(z.lazy(() => ListPlansTier$inboundSchema))), + interval: ListPlansPriceItemInterval$inboundSchema, + interval_count: types.optional(types.number()), + billing_units: types.number(), + billing_method: ListPlansBillingMethod$inboundSchema, + max_purchase: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + "billing_units": "billingUnits", + "billing_method": "billingMethod", + "max_purchase": "maxPurchase", + }); + }), +); + +export function listPlansItemPriceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansItemPrice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansItemPrice' from JSON`, + ); +} + +/** @internal */ +export const ListPlansItemDisplay$inboundSchema: z.ZodMiniType< + ListPlansItemDisplay, + unknown +> = z.pipe( + z.object({ + primary_text: types.string(), + secondary_text: types.optional(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "primary_text": "primaryText", + "secondary_text": "secondaryText", + }); + }), +); + +export function listPlansItemDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansItemDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansItemDisplay' from JSON`, + ); +} + +/** @internal */ +export const ListPlansExpiryDurationType$inboundSchema: z.ZodMiniType< + ListPlansExpiryDurationType, + unknown +> = openEnums.inboundSchema(ListPlansExpiryDurationType); + +/** @internal */ +export const ListPlansRollover$inboundSchema: z.ZodMiniType< + ListPlansRollover, + unknown +> = z.pipe( + z.object({ + max: types.nullable(types.number()), + expiry_duration_type: ListPlansExpiryDurationType$inboundSchema, + expiry_duration_length: types.optional(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "expiry_duration_type": "expiryDurationType", + "expiry_duration_length": "expiryDurationLength", + }); + }), +); + +export function listPlansRolloverFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansRollover$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansRollover' from JSON`, + ); +} + +/** @internal */ +export const ListPlansItem$inboundSchema: z.ZodMiniType< + ListPlansItem, + unknown +> = z.pipe( + z.object({ + feature_id: types.string(), + feature: types.optional(z.lazy(() => ListPlansFeature$inboundSchema)), + included: types.number(), + unlimited: types.boolean(), + reset: types.nullable(z.lazy(() => ListPlansReset$inboundSchema)), + price: types.nullable(z.lazy(() => ListPlansItemPrice$inboundSchema)), + display: types.optional(z.lazy(() => ListPlansItemDisplay$inboundSchema)), + rollover: types.optional(z.lazy(() => ListPlansRollover$inboundSchema)), + }), + z.transform((v) => { + return remap$(v, { + "feature_id": "featureId", + }); + }), +); + +export function listPlansItemFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansItem$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansItem' from JSON`, + ); +} + +/** @internal */ +export const ListPlansDurationType$inboundSchema: z.ZodMiniType< + ListPlansDurationType, + unknown +> = openEnums.inboundSchema(ListPlansDurationType); + +/** @internal */ +export const ListPlansFreeTrial$inboundSchema: z.ZodMiniType< + ListPlansFreeTrial, + unknown +> = z.pipe( + z.object({ + duration_length: types.number(), + duration_type: ListPlansDurationType$inboundSchema, + card_required: types.boolean(), + }), + z.transform((v) => { + return remap$(v, { + "duration_length": "durationLength", + "duration_type": "durationType", + "card_required": "cardRequired", + }); + }), +); + +export function listPlansFreeTrialFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansFreeTrial$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansFreeTrial' from JSON`, + ); +} + +/** @internal */ +export const ListPlansEnv$inboundSchema: z.ZodMiniType = + openEnums.inboundSchema(ListPlansEnv); + +/** @internal */ +export const ListPlansList$inboundSchema: z.ZodMiniType< + ListPlansList, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: types.string(), + description: types.nullable(types.string()), + group: types.nullable(types.string()), + version: types.number(), + add_on: types.boolean(), + auto_enable: types.boolean(), + price: types.nullable(z.lazy(() => ListPlansPrice$inboundSchema)), + items: z.array(z.lazy(() => ListPlansItem$inboundSchema)), + free_trial: types.optional(z.lazy(() => ListPlansFreeTrial$inboundSchema)), + created_at: types.number(), + env: ListPlansEnv$inboundSchema, + archived: types.boolean(), + base_variant_id: types.nullable(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "add_on": "addOn", + "auto_enable": "autoEnable", + "free_trial": "freeTrial", + "created_at": "createdAt", + "base_variant_id": "baseVariantId", + }); + }), +); + +export function listPlansListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansList' from JSON`, ); } @@ -65,7 +907,7 @@ export const ListPlansResponse$inboundSchema: z.ZodMiniType< ListPlansResponse, unknown > = z.object({ - list: z.array(Plan$inboundSchema), + list: z.array(z.lazy(() => ListPlansList$inboundSchema)), }); export function listPlansResponseFromJSON( diff --git a/packages/sdk/src/models/plan.ts b/packages/sdk/src/models/plan.ts index 98bd4bfc4..532f8e222 100644 --- a/packages/sdk/src/models/plan.ts +++ b/packages/sdk/src/models/plan.ts @@ -12,6 +12,9 @@ import * as types from "../types/primitives.js"; import { smartUnion } from "../types/smart-union.js"; import { SDKValidationError } from "./sdk-validation-error.js"; +/** + * Billing interval (e.g. 'month', 'year'). + */ export const PlanPriceInterval = { OneOff: "one_off", Week: "week", @@ -20,18 +23,42 @@ export const PlanPriceInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ export type PlanPriceInterval = OpenEnum; -export type PriceDisplay = { +/** + * Display text for showing this price in pricing pages. + */ +export type PlanPriceDisplay = { + /** + * Main display text (e.g. '$10' or '100 messages'). + */ primaryText: string; + /** + * Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + */ secondaryText?: string | undefined; }; export type PlanPrice = { + /** + * Base price amount for the plan. + */ amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ interval: PlanPriceInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ intervalCount?: number | undefined; - display?: PriceDisplay | undefined; + /** + * Display text for showing this price in pricing pages. + */ + display?: PlanPriceDisplay | undefined; }; /** @@ -71,6 +98,9 @@ export type PlanCreditSchema = { creditCost: number; }; +/** + * The full feature object if expanded. + */ export type PlanFeature = { /** * The ID of the feature, used to refer to it in other API calls like /track or /check. @@ -98,6 +128,9 @@ export type PlanFeature = { archived?: boolean | null | undefined; }; +/** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ export const PlanResetInterval = { OneOff: "one_off", Minute: "minute", @@ -109,10 +142,19 @@ export const PlanResetInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ export type PlanResetInterval = OpenEnum; export type PlanReset = { + /** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ interval: PlanResetInterval; + /** + * Number of intervals between resets. Defaults to 1. + */ intervalCount?: number | undefined; }; @@ -123,6 +165,9 @@ export type PlanTier = { amount: number; }; +/** + * Billing interval for this price. For consumable features, should match reset.interval. + */ export const PlanPriceItemInterval = { OneOff: "one_off", Week: "week", @@ -131,128 +176,233 @@ export const PlanPriceItemInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Billing interval for this price. For consumable features, should match reset.interval. + */ export type PlanPriceItemInterval = OpenEnum; +/** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ export const PlanBillingMethod = { Prepaid: "prepaid", UsageBased: "usage_based", } as const; +/** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ export type PlanBillingMethod = OpenEnum; export type PlanItemPrice = { + /** + * Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + */ amount?: number | undefined; + /** + * Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + */ tiers?: Array | undefined; + /** + * Billing interval for this price. For consumable features, should match reset.interval. + */ interval: PlanPriceItemInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ intervalCount?: number | undefined; + /** + * Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + */ billingUnits: number; + /** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ billingMethod: PlanBillingMethod; + /** + * Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + */ maxPurchase: number | null; }; +/** + * Display text for showing this item in pricing pages. + */ export type PlanItemDisplay = { + /** + * Main display text (e.g. '$10' or '100 messages'). + */ primaryText: string; + /** + * Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + */ secondaryText?: string | undefined; }; +/** + * When rolled over units expire. + */ export const ExpiryDurationType = { Month: "month", Forever: "forever", } as const; +/** + * When rolled over units expire. + */ export type ExpiryDurationType = OpenEnum; +/** + * Rollover configuration for unused units. If set, unused included units roll over to the next period. + */ export type PlanRollover = { + /** + * Maximum rollover units. Null for unlimited rollover. + */ max: number | null; + /** + * When rolled over units expire. + */ expiryDurationType: ExpiryDurationType; + /** + * Number of periods before expiry. + */ expiryDurationLength?: number | undefined; }; -export const OnIncrease = { - BillImmediately: "bill_immediately", - ProrateImmediately: "prorate_immediately", - ProrateNextCycle: "prorate_next_cycle", - BillNextCycle: "bill_next_cycle", -} as const; -export type OnIncrease = OpenEnum; - -export const OnDecrease = { - Prorate: "prorate", - ProrateImmediately: "prorate_immediately", - ProrateNextCycle: "prorate_next_cycle", - None: "none", - NoProrations: "no_prorations", -} as const; -export type OnDecrease = OpenEnum; - -export type Proration = { - onIncrease?: OnIncrease | undefined; - onDecrease?: OnDecrease | undefined; -}; - export type Item = { + /** + * The ID of the feature this item configures. + */ featureId: string; + /** + * The full feature object if expanded. + */ feature?: PlanFeature | undefined; + /** + * Number of free units included. For consumable features, balance resets to this number each interval. + */ included: number; + /** + * Whether the customer has unlimited access to this feature. + */ unlimited: boolean; + /** + * Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. + */ reset: PlanReset | null; + /** + * Pricing configuration for usage beyond included units. Null if feature is entirely free. + */ price: PlanItemPrice | null; + /** + * Display text for showing this item in pricing pages. + */ display?: PlanItemDisplay | undefined; + /** + * Rollover configuration for unused units. If set, unused included units roll over to the next period. + */ rollover?: PlanRollover | undefined; - proration?: Proration | undefined; }; +/** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ export const PlanDurationType = { Day: "day", Month: "month", Year: "year", } as const; +/** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ export type PlanDurationType = OpenEnum; +/** + * Free trial configuration. If set, new customers can try this plan before being charged. + */ export type FreeTrial = { + /** + * Number of duration_type periods the trial lasts. + */ durationLength: number; + /** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ durationType: PlanDurationType; + /** + * Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + */ cardRequired: boolean; }; +/** + * Environment this plan belongs to ('sandbox' or 'live'). + */ export const PlanEnv = { Sandbox: "sandbox", Live: "live", } as const; +/** + * Environment this plan belongs to ('sandbox' or 'live'). + */ export type PlanEnv = OpenEnum; -export const Scenario = { - Scheduled: "scheduled", - Active: "active", - New: "new", - Renew: "renew", - Upgrade: "upgrade", - Downgrade: "downgrade", - Cancel: "cancel", - Expired: "expired", - PastDue: "past_due", -} as const; -export type Scenario = OpenEnum; - -export type CustomerEligibility = { - trialAvailable?: boolean | undefined; - scenario: Scenario; -}; - export type Plan = { + /** + * Unique identifier for the plan. + */ id: string; + /** + * Display name of the plan. + */ name: string; + /** + * Optional description of the plan. + */ description: string | null; + /** + * Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + */ group: string | null; + /** + * Version number of the plan. Incremented when plan configuration changes. + */ version: number; + /** + * Whether this is an add-on plan that can be attached alongside a main plan. + */ addOn: boolean; + /** + * If true, this plan is automatically attached when a customer is created. Used for free plans. + */ autoEnable: boolean; + /** + * Base recurring price for the plan. Null for free plans or usage-only plans. + */ price: PlanPrice | null; + /** + * Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. + */ items: Array; + /** + * Free trial configuration. If set, new customers can try this plan before being charged. + */ freeTrial?: FreeTrial | undefined; + /** + * Unix timestamp (ms) when the plan was created. + */ createdAt: number; + /** + * Environment this plan belongs to ('sandbox' or 'live'). + */ env: PlanEnv; + /** + * Whether the plan is archived. Archived plans cannot be attached to new customers. + */ archived: boolean; + /** + * If this is a variant, the ID of the base plan it was created from. + */ baseVariantId: string | null; - customerEligibility?: CustomerEligibility | undefined; }; /** @internal */ @@ -262,27 +412,29 @@ export const PlanPriceInterval$inboundSchema: z.ZodMiniType< > = openEnums.inboundSchema(PlanPriceInterval); /** @internal */ -export const PriceDisplay$inboundSchema: z.ZodMiniType = - z.pipe( - z.object({ - primary_text: types.string(), - secondary_text: types.optional(types.string()), - }), - z.transform((v) => { - return remap$(v, { - "primary_text": "primaryText", - "secondary_text": "secondaryText", - }); - }), - ); +export const PlanPriceDisplay$inboundSchema: z.ZodMiniType< + PlanPriceDisplay, + unknown +> = z.pipe( + z.object({ + primary_text: types.string(), + secondary_text: types.optional(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "primary_text": "primaryText", + "secondary_text": "secondaryText", + }); + }), +); -export function priceDisplayFromJSON( +export function planPriceDisplayFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => PriceDisplay$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'PriceDisplay' from JSON`, + (x) => PlanPriceDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PlanPriceDisplay' from JSON`, ); } @@ -293,7 +445,7 @@ export const PlanPrice$inboundSchema: z.ZodMiniType = z amount: types.number(), interval: PlanPriceInterval$inboundSchema, interval_count: types.optional(types.number()), - display: types.optional(z.lazy(() => PriceDisplay$inboundSchema)), + display: types.optional(z.lazy(() => PlanPriceDisplay$inboundSchema)), }), z.transform((v) => { return remap$(v, { @@ -562,39 +714,6 @@ export function planRolloverFromJSON( ); } -/** @internal */ -export const OnIncrease$inboundSchema: z.ZodMiniType = - openEnums.inboundSchema(OnIncrease); - -/** @internal */ -export const OnDecrease$inboundSchema: z.ZodMiniType = - openEnums.inboundSchema(OnDecrease); - -/** @internal */ -export const Proration$inboundSchema: z.ZodMiniType = z - .pipe( - z.object({ - on_increase: types.optional(OnIncrease$inboundSchema), - on_decrease: types.optional(OnDecrease$inboundSchema), - }), - z.transform((v) => { - return remap$(v, { - "on_increase": "onIncrease", - "on_decrease": "onDecrease", - }); - }), - ); - -export function prorationFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => Proration$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'Proration' from JSON`, - ); -} - /** @internal */ export const Item$inboundSchema: z.ZodMiniType = z.pipe( z.object({ @@ -606,7 +725,6 @@ export const Item$inboundSchema: z.ZodMiniType = z.pipe( price: types.nullable(z.lazy(() => PlanItemPrice$inboundSchema)), display: types.optional(z.lazy(() => PlanItemDisplay$inboundSchema)), rollover: types.optional(z.lazy(() => PlanRollover$inboundSchema)), - proration: types.optional(z.lazy(() => Proration$inboundSchema)), }), z.transform((v) => { return remap$(v, { @@ -662,36 +780,6 @@ export function freeTrialFromJSON( export const PlanEnv$inboundSchema: z.ZodMiniType = openEnums .inboundSchema(PlanEnv); -/** @internal */ -export const Scenario$inboundSchema: z.ZodMiniType = - openEnums.inboundSchema(Scenario); - -/** @internal */ -export const CustomerEligibility$inboundSchema: z.ZodMiniType< - CustomerEligibility, - unknown -> = z.pipe( - z.object({ - trial_available: types.optional(types.boolean()), - scenario: Scenario$inboundSchema, - }), - z.transform((v) => { - return remap$(v, { - "trial_available": "trialAvailable", - }); - }), -); - -export function customerEligibilityFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => CustomerEligibility$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'CustomerEligibility' from JSON`, - ); -} - /** @internal */ export const Plan$inboundSchema: z.ZodMiniType = z.pipe( z.object({ @@ -709,9 +797,6 @@ export const Plan$inboundSchema: z.ZodMiniType = z.pipe( env: PlanEnv$inboundSchema, archived: types.boolean(), base_variant_id: types.nullable(types.string()), - customer_eligibility: types.optional(z.lazy(() => - CustomerEligibility$inboundSchema - )), }), z.transform((v) => { return remap$(v, { @@ -720,7 +805,6 @@ export const Plan$inboundSchema: z.ZodMiniType = z.pipe( "free_trial": "freeTrial", "created_at": "createdAt", "base_variant_id": "baseVariantId", - "customer_eligibility": "customerEligibility", }); }), ); diff --git a/packages/sdk/src/models/preview-attach-op.ts b/packages/sdk/src/models/preview-attach-op.ts index a6e20f4ca..6e9a3651c 100644 --- a/packages/sdk/src/models/preview-attach-op.ts +++ b/packages/sdk/src/models/preview-attach-op.ts @@ -21,21 +21,39 @@ export type PreviewAttachFeatureQuantity = { adjustable?: boolean | undefined; }; +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ export const PreviewAttachDurationType = { Day: "day", Month: "month", Year: "year", } as const; +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ export type PreviewAttachDurationType = ClosedEnum< typeof PreviewAttachDurationType >; export type PreviewAttachFreeTrial = { + /** + * Number of duration_type periods the trial lasts. + */ durationLength: number; + /** + * Unit of time for the trial ('day', 'month', 'year'). + */ durationType?: PreviewAttachDurationType | undefined; + /** + * If true, payment method required to start trial. Customer is charged after trial ends. + */ cardRequired?: boolean | undefined; }; +/** + * Billing interval (e.g. 'month', 'year'). + */ export const PreviewAttachPriceInterval = { OneOff: "one_off", Week: "week", @@ -44,16 +62,31 @@ export const PreviewAttachPriceInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ export type PreviewAttachPriceInterval = ClosedEnum< typeof PreviewAttachPriceInterval >; export type PreviewAttachPrice = { + /** + * Base price amount for the plan. + */ amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ interval: PreviewAttachPriceInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ intervalCount?: number | undefined; }; +/** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ export const PreviewAttachResetInterval = { OneOff: "one_off", Minute: "minute", @@ -65,12 +98,24 @@ export const PreviewAttachResetInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ export type PreviewAttachResetInterval = ClosedEnum< typeof PreviewAttachResetInterval >; +/** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ export type PreviewAttachReset = { + /** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ interval: PreviewAttachResetInterval; + /** + * Number of intervals between resets. Defaults to 1. + */ intervalCount?: number | undefined; }; @@ -81,6 +126,9 @@ export type PreviewAttachTier = { amount: number; }; +/** + * Billing interval. For consumable features, should match reset.interval. + */ export const PreviewAttachItemPriceInterval = { OneOff: "one_off", Week: "week", @@ -89,38 +137,80 @@ export const PreviewAttachItemPriceInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Billing interval. For consumable features, should match reset.interval. + */ export type PreviewAttachItemPriceInterval = ClosedEnum< typeof PreviewAttachItemPriceInterval >; +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ export const PreviewAttachBillingMethod = { Prepaid: "prepaid", UsageBased: "usage_based", } as const; +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ export type PreviewAttachBillingMethod = ClosedEnum< typeof PreviewAttachBillingMethod >; +/** + * Pricing for usage beyond included units. Omit for free features. + */ export type PreviewAttachItemPrice = { + /** + * Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + */ amount?: number | undefined; + /** + * Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + */ tiers?: Array | undefined; + /** + * Billing interval. For consumable features, should match reset.interval. + */ interval: PreviewAttachItemPriceInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ intervalCount?: number | undefined; + /** + * Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + */ billingUnits?: number | undefined; + /** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ billingMethod: PreviewAttachBillingMethod; + /** + * Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + */ maxPurchase?: number | undefined; }; +/** + * Billing behavior when quantity increases mid-cycle. + */ export const PreviewAttachOnIncrease = { BillImmediately: "bill_immediately", ProrateImmediately: "prorate_immediately", ProrateNextCycle: "prorate_next_cycle", BillNextCycle: "bill_next_cycle", } as const; +/** + * Billing behavior when quantity increases mid-cycle. + */ export type PreviewAttachOnIncrease = ClosedEnum< typeof PreviewAttachOnIncrease >; +/** + * Credit behavior when quantity decreases mid-cycle. + */ export const PreviewAttachOnDecrease = { Prorate: "prorate", ProrateImmediately: "prorate_immediately", @@ -128,36 +218,87 @@ export const PreviewAttachOnDecrease = { None: "none", NoProrations: "no_prorations", } as const; +/** + * Credit behavior when quantity decreases mid-cycle. + */ export type PreviewAttachOnDecrease = ClosedEnum< typeof PreviewAttachOnDecrease >; +/** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ export type PreviewAttachProration = { + /** + * Billing behavior when quantity increases mid-cycle. + */ onIncrease: PreviewAttachOnIncrease; + /** + * Credit behavior when quantity decreases mid-cycle. + */ onDecrease: PreviewAttachOnDecrease; }; +/** + * When rolled over units expire. + */ export const PreviewAttachExpiryDurationType = { Month: "month", Forever: "forever", } as const; +/** + * When rolled over units expire. + */ export type PreviewAttachExpiryDurationType = ClosedEnum< typeof PreviewAttachExpiryDurationType >; +/** + * Rollover config for unused units. If set, unused included units carry over. + */ export type PreviewAttachRollover = { + /** + * Max rollover units. Omit for unlimited rollover. + */ max?: number | undefined; + /** + * When rolled over units expire. + */ expiryDurationType: PreviewAttachExpiryDurationType; + /** + * Number of periods before expiry. + */ expiryDurationLength?: number | undefined; }; export type PreviewAttachItem = { + /** + * The ID of the feature to configure. + */ featureId: string; + /** + * Number of free units included. Balance resets to this each interval for consumable features. + */ included?: number | undefined; + /** + * If true, customer has unlimited access to this feature. + */ unlimited?: boolean | undefined; + /** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ reset?: PreviewAttachReset | undefined; + /** + * Pricing for usage beyond included units. Omit for free features. + */ price?: PreviewAttachItemPrice | undefined; + /** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ proration?: PreviewAttachProration | undefined; + /** + * Rollover config for unused units. If set, unused included units carry over. + */ rollover?: PreviewAttachRollover | undefined; }; diff --git a/packages/sdk/src/models/preview-update-op.ts b/packages/sdk/src/models/preview-update-op.ts index af9a1c0d1..9b566805e 100644 --- a/packages/sdk/src/models/preview-update-op.ts +++ b/packages/sdk/src/models/preview-update-op.ts @@ -21,21 +21,39 @@ export type PreviewUpdateFeatureQuantity = { adjustable?: boolean | undefined; }; +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ export const PreviewUpdateDurationType = { Day: "day", Month: "month", Year: "year", } as const; +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ export type PreviewUpdateDurationType = ClosedEnum< typeof PreviewUpdateDurationType >; export type PreviewUpdateFreeTrial = { + /** + * Number of duration_type periods the trial lasts. + */ durationLength: number; + /** + * Unit of time for the trial ('day', 'month', 'year'). + */ durationType?: PreviewUpdateDurationType | undefined; + /** + * If true, payment method required to start trial. Customer is charged after trial ends. + */ cardRequired?: boolean | undefined; }; +/** + * Billing interval (e.g. 'month', 'year'). + */ export const PreviewUpdatePriceInterval = { OneOff: "one_off", Week: "week", @@ -44,16 +62,31 @@ export const PreviewUpdatePriceInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ export type PreviewUpdatePriceInterval = ClosedEnum< typeof PreviewUpdatePriceInterval >; export type PreviewUpdatePrice = { + /** + * Base price amount for the plan. + */ amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ interval: PreviewUpdatePriceInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ intervalCount?: number | undefined; }; +/** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ export const PreviewUpdateResetInterval = { OneOff: "one_off", Minute: "minute", @@ -65,12 +98,24 @@ export const PreviewUpdateResetInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ export type PreviewUpdateResetInterval = ClosedEnum< typeof PreviewUpdateResetInterval >; +/** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ export type PreviewUpdateReset = { + /** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ interval: PreviewUpdateResetInterval; + /** + * Number of intervals between resets. Defaults to 1. + */ intervalCount?: number | undefined; }; @@ -81,6 +126,9 @@ export type PreviewUpdateTier = { amount: number; }; +/** + * Billing interval. For consumable features, should match reset.interval. + */ export const PreviewUpdateItemPriceInterval = { OneOff: "one_off", Week: "week", @@ -89,38 +137,80 @@ export const PreviewUpdateItemPriceInterval = { SemiAnnual: "semi_annual", Year: "year", } as const; +/** + * Billing interval. For consumable features, should match reset.interval. + */ export type PreviewUpdateItemPriceInterval = ClosedEnum< typeof PreviewUpdateItemPriceInterval >; +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ export const PreviewUpdateBillingMethod = { Prepaid: "prepaid", UsageBased: "usage_based", } as const; +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ export type PreviewUpdateBillingMethod = ClosedEnum< typeof PreviewUpdateBillingMethod >; +/** + * Pricing for usage beyond included units. Omit for free features. + */ export type PreviewUpdateItemPrice = { + /** + * Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + */ amount?: number | undefined; + /** + * Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + */ tiers?: Array | undefined; + /** + * Billing interval. For consumable features, should match reset.interval. + */ interval: PreviewUpdateItemPriceInterval; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ intervalCount?: number | undefined; + /** + * Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + */ billingUnits?: number | undefined; + /** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ billingMethod: PreviewUpdateBillingMethod; + /** + * Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + */ maxPurchase?: number | undefined; }; +/** + * Billing behavior when quantity increases mid-cycle. + */ export const PreviewUpdateOnIncrease = { BillImmediately: "bill_immediately", ProrateImmediately: "prorate_immediately", ProrateNextCycle: "prorate_next_cycle", BillNextCycle: "bill_next_cycle", } as const; +/** + * Billing behavior when quantity increases mid-cycle. + */ export type PreviewUpdateOnIncrease = ClosedEnum< typeof PreviewUpdateOnIncrease >; +/** + * Credit behavior when quantity decreases mid-cycle. + */ export const PreviewUpdateOnDecrease = { Prorate: "prorate", ProrateImmediately: "prorate_immediately", @@ -128,36 +218,87 @@ export const PreviewUpdateOnDecrease = { None: "none", NoProrations: "no_prorations", } as const; +/** + * Credit behavior when quantity decreases mid-cycle. + */ export type PreviewUpdateOnDecrease = ClosedEnum< typeof PreviewUpdateOnDecrease >; +/** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ export type PreviewUpdateProration = { + /** + * Billing behavior when quantity increases mid-cycle. + */ onIncrease: PreviewUpdateOnIncrease; + /** + * Credit behavior when quantity decreases mid-cycle. + */ onDecrease: PreviewUpdateOnDecrease; }; +/** + * When rolled over units expire. + */ export const PreviewUpdateExpiryDurationType = { Month: "month", Forever: "forever", } as const; +/** + * When rolled over units expire. + */ export type PreviewUpdateExpiryDurationType = ClosedEnum< typeof PreviewUpdateExpiryDurationType >; +/** + * Rollover config for unused units. If set, unused included units carry over. + */ export type PreviewUpdateRollover = { + /** + * Max rollover units. Omit for unlimited rollover. + */ max?: number | undefined; + /** + * When rolled over units expire. + */ expiryDurationType: PreviewUpdateExpiryDurationType; + /** + * Number of periods before expiry. + */ expiryDurationLength?: number | undefined; }; export type PreviewUpdateItem = { + /** + * The ID of the feature to configure. + */ featureId: string; + /** + * Number of free units included. Balance resets to this each interval for consumable features. + */ included?: number | undefined; + /** + * If true, customer has unlimited access to this feature. + */ unlimited?: boolean | undefined; + /** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ reset?: PreviewUpdateReset | undefined; + /** + * Pricing for usage beyond included units. Omit for free features. + */ price?: PreviewUpdateItemPrice | undefined; + /** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ proration?: PreviewUpdateProration | undefined; + /** + * Rollover config for unused units. If set, unused included units carry over. + */ rollover?: PreviewUpdateRollover | undefined; }; diff --git a/packages/sdk/src/models/setup-payment-op.ts b/packages/sdk/src/models/setup-payment-op.ts new file mode 100644 index 000000000..96a093bc9 --- /dev/null +++ b/packages/sdk/src/models/setup-payment-op.ts @@ -0,0 +1,115 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { + CustomerData, + CustomerData$Outbound, + CustomerData$outboundSchema, +} from "./customer-data.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type SetupPaymentGlobals = { + xApiVersion?: string | undefined; +}; + +export type SetupPaymentParams = { + /** + * The ID of the customer + */ + customerId: string; + /** + * URL to redirect to after successful payment setup. Must start with either http:// or https:// + */ + successUrl?: string | undefined; + /** + * Customer details to set when creating a customer + */ + customerData?: CustomerData | undefined; + /** + * Additional parameters for the checkout session + */ + checkoutSessionParams?: { [k: string]: any } | undefined; +}; + +/** + * OK + */ +export type SetupPaymentResponse = { + /** + * The ID of the customer + */ + customerId: string; + /** + * URL to the payment setup page + */ + url: string; +}; + +/** @internal */ +export type SetupPaymentParams$Outbound = { + customer_id: string; + success_url?: string | undefined; + customer_data?: CustomerData$Outbound | undefined; + checkout_session_params?: { [k: string]: any } | undefined; +}; + +/** @internal */ +export const SetupPaymentParams$outboundSchema: z.ZodMiniType< + SetupPaymentParams$Outbound, + SetupPaymentParams +> = z.pipe( + z.object({ + customerId: z.string(), + successUrl: z.optional(z.string()), + customerData: z.optional(CustomerData$outboundSchema), + checkoutSessionParams: z.optional(z.record(z.string(), z.any())), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + successUrl: "success_url", + customerData: "customer_data", + checkoutSessionParams: "checkout_session_params", + }); + }), +); + +export function setupPaymentParamsToJSON( + setupPaymentParams: SetupPaymentParams, +): string { + return JSON.stringify( + SetupPaymentParams$outboundSchema.parse(setupPaymentParams), + ); +} + +/** @internal */ +export const SetupPaymentResponse$inboundSchema: z.ZodMiniType< + SetupPaymentResponse, + unknown +> = z.pipe( + z.object({ + customer_id: types.string(), + url: types.string(), + }), + z.transform((v) => { + return remap$(v, { + "customer_id": "customerId", + }); + }), +); + +export function setupPaymentResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => SetupPaymentResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'SetupPaymentResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/update-plan-op.ts b/packages/sdk/src/models/update-plan-op.ts new file mode 100644 index 000000000..d1b862dd2 --- /dev/null +++ b/packages/sdk/src/models/update-plan-op.ts @@ -0,0 +1,1578 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { ClosedEnum, OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { smartUnion } from "../types/smart-union.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type UpdatePlanGlobals = { + xApiVersion?: string | undefined; +}; + +/** + * Billing interval (e.g. 'month', 'year'). + */ +export const UpdatePlanPriceIntervalRequest = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ +export type UpdatePlanPriceIntervalRequest = ClosedEnum< + typeof UpdatePlanPriceIntervalRequest +>; + +export type UpdatePlanPriceRequest = { + /** + * Base price amount for the plan. + */ + amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ + interval: UpdatePlanPriceIntervalRequest; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ + intervalCount?: number | undefined; +}; + +/** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ +export const UpdatePlanResetIntervalRequest = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ +export type UpdatePlanResetIntervalRequest = ClosedEnum< + typeof UpdatePlanResetIntervalRequest +>; + +/** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ +export type UpdatePlanResetRequest = { + /** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ + interval: UpdatePlanResetIntervalRequest; + /** + * Number of intervals between resets. Defaults to 1. + */ + intervalCount?: number | undefined; +}; + +export type UpdatePlanToRequest = number | string; + +export type UpdatePlanTierRequest = { + to: number | string; + amount: number; +}; + +/** + * Billing interval. For consumable features, should match reset.interval. + */ +export const UpdatePlanItemPriceIntervalRequest = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval. For consumable features, should match reset.interval. + */ +export type UpdatePlanItemPriceIntervalRequest = ClosedEnum< + typeof UpdatePlanItemPriceIntervalRequest +>; + +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ +export const UpdatePlanBillingMethodRequest = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ +export type UpdatePlanBillingMethodRequest = ClosedEnum< + typeof UpdatePlanBillingMethodRequest +>; + +/** + * Pricing for usage beyond included units. Omit for free features. + */ +export type UpdatePlanItemPriceRequest = { + /** + * Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + */ + amount?: number | undefined; + /** + * Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + */ + tiers?: Array | undefined; + /** + * Billing interval. For consumable features, should match reset.interval. + */ + interval: UpdatePlanItemPriceIntervalRequest; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ + intervalCount?: number | undefined; + /** + * Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200). + */ + billingUnits?: number | undefined; + /** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ + billingMethod: UpdatePlanBillingMethodRequest; + /** + * Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. + */ + maxPurchase?: number | undefined; +}; + +/** + * Billing behavior when quantity increases mid-cycle. + */ +export const UpdatePlanOnIncrease = { + BillImmediately: "bill_immediately", + ProrateImmediately: "prorate_immediately", + ProrateNextCycle: "prorate_next_cycle", + BillNextCycle: "bill_next_cycle", +} as const; +/** + * Billing behavior when quantity increases mid-cycle. + */ +export type UpdatePlanOnIncrease = ClosedEnum; + +/** + * Credit behavior when quantity decreases mid-cycle. + */ +export const UpdatePlanOnDecrease = { + Prorate: "prorate", + ProrateImmediately: "prorate_immediately", + ProrateNextCycle: "prorate_next_cycle", + None: "none", + NoProrations: "no_prorations", +} as const; +/** + * Credit behavior when quantity decreases mid-cycle. + */ +export type UpdatePlanOnDecrease = ClosedEnum; + +/** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ +export type UpdatePlanProration = { + /** + * Billing behavior when quantity increases mid-cycle. + */ + onIncrease: UpdatePlanOnIncrease; + /** + * Credit behavior when quantity decreases mid-cycle. + */ + onDecrease: UpdatePlanOnDecrease; +}; + +/** + * When rolled over units expire. + */ +export const UpdatePlanExpiryDurationTypeRequest = { + Month: "month", + Forever: "forever", +} as const; +/** + * When rolled over units expire. + */ +export type UpdatePlanExpiryDurationTypeRequest = ClosedEnum< + typeof UpdatePlanExpiryDurationTypeRequest +>; + +/** + * Rollover config for unused units. If set, unused included units carry over. + */ +export type UpdatePlanRolloverRequest = { + /** + * Max rollover units. Omit for unlimited rollover. + */ + max?: number | undefined; + /** + * When rolled over units expire. + */ + expiryDurationType: UpdatePlanExpiryDurationTypeRequest; + /** + * Number of periods before expiry. + */ + expiryDurationLength?: number | undefined; +}; + +export type UpdatePlanItemRequest = { + /** + * The ID of the feature to configure. + */ + featureId: string; + /** + * Number of free units included. Balance resets to this each interval for consumable features. + */ + included?: number | undefined; + /** + * If true, customer has unlimited access to this feature. + */ + unlimited?: boolean | undefined; + /** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ + reset?: UpdatePlanResetRequest | undefined; + /** + * Pricing for usage beyond included units. Omit for free features. + */ + price?: UpdatePlanItemPriceRequest | undefined; + /** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ + proration?: UpdatePlanProration | undefined; + /** + * Rollover config for unused units. If set, unused included units carry over. + */ + rollover?: UpdatePlanRolloverRequest | undefined; +}; + +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ +export const UpdatePlanDurationTypeRequest = { + Day: "day", + Month: "month", + Year: "year", +} as const; +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ +export type UpdatePlanDurationTypeRequest = ClosedEnum< + typeof UpdatePlanDurationTypeRequest +>; + +export type UpdatePlanFreeTrialRequest = { + /** + * Number of duration_type periods the trial lasts. + */ + durationLength: number; + /** + * Unit of time for the trial ('day', 'month', 'year'). + */ + durationType?: UpdatePlanDurationTypeRequest | undefined; + /** + * If true, payment method required to start trial. Customer is charged after trial ends. + */ + cardRequired?: boolean | undefined; +}; + +export type UpdatePlanParams = { + /** + * The ID of the plan to update. + */ + planId: string; + /** + * Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + */ + group?: string | undefined; + /** + * Display name of the plan. + */ + name?: string | undefined; + description?: string | undefined; + /** + * Whether the plan is an add-on. + */ + addOn?: boolean | undefined; + /** + * Whether the plan is automatically enabled. + */ + autoEnable?: boolean | undefined; + /** + * The price of the plan. Set to null to remove the base price. + */ + price?: UpdatePlanPriceRequest | null | undefined; + /** + * Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. + */ + items?: Array | undefined; + /** + * The free trial of the plan. Set to null to remove the free trial. + */ + freeTrial?: UpdatePlanFreeTrialRequest | null | undefined; + version?: number | undefined; + archived?: boolean | undefined; + /** + * The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. + */ + newPlanId?: string | undefined; +}; + +/** + * Billing interval (e.g. 'month', 'year'). + */ +export const UpdatePlanPriceIntervalResponse = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ +export type UpdatePlanPriceIntervalResponse = OpenEnum< + typeof UpdatePlanPriceIntervalResponse +>; + +/** + * Display text for showing this price in pricing pages. + */ +export type UpdatePlanPriceDisplay = { + /** + * Main display text (e.g. '$10' or '100 messages'). + */ + primaryText: string; + /** + * Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + */ + secondaryText?: string | undefined; +}; + +export type UpdatePlanPriceResponse = { + /** + * Base price amount for the plan. + */ + amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ + interval: UpdatePlanPriceIntervalResponse; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ + intervalCount?: number | undefined; + /** + * Display text for showing this price in pricing pages. + */ + display?: UpdatePlanPriceDisplay | undefined; +}; + +/** + * The type of the feature + */ +export const UpdatePlanType = { + Static: "static", + Boolean: "boolean", + SingleUse: "single_use", + ContinuousUse: "continuous_use", + CreditSystem: "credit_system", +} as const; +/** + * The type of the feature + */ +export type UpdatePlanType = OpenEnum; + +export type UpdatePlanFeatureDisplay = { + /** + * The singular display name for the feature. + */ + singular: string; + /** + * The plural display name for the feature. + */ + plural: string; +}; + +export type UpdatePlanCreditSchema = { + /** + * The ID of the metered feature (should be a single_use feature). + */ + meteredFeatureId: string; + /** + * The credit cost of the metered feature. + */ + creditCost: number; +}; + +/** + * The full feature object if expanded. + */ +export type UpdatePlanFeature = { + /** + * The ID of the feature, used to refer to it in other API calls like /track or /check. + */ + id: string; + /** + * The name of the feature. + */ + name?: string | null | undefined; + /** + * The type of the feature + */ + type: UpdatePlanType; + /** + * Singular and plural display names for the feature. + */ + display?: UpdatePlanFeatureDisplay | null | undefined; + /** + * Credit cost schema for credit system features. + */ + creditSchema?: Array | null | undefined; + /** + * Whether or not the feature is archived. + */ + archived?: boolean | null | undefined; +}; + +/** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ +export const UpdatePlanResetIntervalResponse = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ +export type UpdatePlanResetIntervalResponse = OpenEnum< + typeof UpdatePlanResetIntervalResponse +>; + +export type UpdatePlanResetResponse = { + /** + * The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored. + */ + interval: UpdatePlanResetIntervalResponse; + /** + * Number of intervals between resets. Defaults to 1. + */ + intervalCount?: number | undefined; +}; + +export type UpdatePlanToResponse = number | string; + +export type UpdatePlanTierResponse = { + to: number | string; + amount: number; +}; + +/** + * Billing interval for this price. For consumable features, should match reset.interval. + */ +export const UpdatePlanPriceItemIntervalResponse = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval for this price. For consumable features, should match reset.interval. + */ +export type UpdatePlanPriceItemIntervalResponse = OpenEnum< + typeof UpdatePlanPriceItemIntervalResponse +>; + +/** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ +export const UpdatePlanBillingMethodResponse = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +/** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ +export type UpdatePlanBillingMethodResponse = OpenEnum< + typeof UpdatePlanBillingMethodResponse +>; + +export type UpdatePlanItemPriceResponse = { + /** + * Price per billing_units after included usage is consumed. Mutually exclusive with tiers. + */ + amount?: number | undefined; + /** + * Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + */ + tiers?: Array | undefined; + /** + * Billing interval for this price. For consumable features, should match reset.interval. + */ + interval: UpdatePlanPriceItemIntervalResponse; + /** + * Number of intervals per billing cycle. Defaults to 1. + */ + intervalCount?: number | undefined; + /** + * Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200). + */ + billingUnits: number; + /** + * 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage. + */ + billingMethod: UpdatePlanBillingMethodResponse; + /** + * Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit. + */ + maxPurchase: number | null; +}; + +/** + * Display text for showing this item in pricing pages. + */ +export type UpdatePlanItemDisplay = { + /** + * Main display text (e.g. '$10' or '100 messages'). + */ + primaryText: string; + /** + * Secondary display text (e.g. 'per month' or 'then $0.5 per 100'). + */ + secondaryText?: string | undefined; +}; + +/** + * When rolled over units expire. + */ +export const UpdatePlanExpiryDurationTypeResponse = { + Month: "month", + Forever: "forever", +} as const; +/** + * When rolled over units expire. + */ +export type UpdatePlanExpiryDurationTypeResponse = OpenEnum< + typeof UpdatePlanExpiryDurationTypeResponse +>; + +/** + * Rollover configuration for unused units. If set, unused included units roll over to the next period. + */ +export type UpdatePlanRolloverResponse = { + /** + * Maximum rollover units. Null for unlimited rollover. + */ + max: number | null; + /** + * When rolled over units expire. + */ + expiryDurationType: UpdatePlanExpiryDurationTypeResponse; + /** + * Number of periods before expiry. + */ + expiryDurationLength?: number | undefined; +}; + +export type UpdatePlanItemResponse = { + /** + * The ID of the feature this item configures. + */ + featureId: string; + /** + * The full feature object if expanded. + */ + feature?: UpdatePlanFeature | undefined; + /** + * Number of free units included. For consumable features, balance resets to this number each interval. + */ + included: number; + /** + * Whether the customer has unlimited access to this feature. + */ + unlimited: boolean; + /** + * Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles. + */ + reset: UpdatePlanResetResponse | null; + /** + * Pricing configuration for usage beyond included units. Null if feature is entirely free. + */ + price: UpdatePlanItemPriceResponse | null; + /** + * Display text for showing this item in pricing pages. + */ + display?: UpdatePlanItemDisplay | undefined; + /** + * Rollover configuration for unused units. If set, unused included units roll over to the next period. + */ + rollover?: UpdatePlanRolloverResponse | undefined; +}; + +/** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ +export const UpdatePlanDurationTypeResponse = { + Day: "day", + Month: "month", + Year: "year", +} as const; +/** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ +export type UpdatePlanDurationTypeResponse = OpenEnum< + typeof UpdatePlanDurationTypeResponse +>; + +/** + * Free trial configuration. If set, new customers can try this plan before being charged. + */ +export type UpdatePlanFreeTrialResponse = { + /** + * Number of duration_type periods the trial lasts. + */ + durationLength: number; + /** + * Unit of time for the trial duration ('day', 'month', 'year'). + */ + durationType: UpdatePlanDurationTypeResponse; + /** + * Whether a payment method is required to start the trial. If true, customer will be charged after trial ends. + */ + cardRequired: boolean; +}; + +/** + * Environment this plan belongs to ('sandbox' or 'live'). + */ +export const UpdatePlanEnv = { + Sandbox: "sandbox", + Live: "live", +} as const; +/** + * Environment this plan belongs to ('sandbox' or 'live'). + */ +export type UpdatePlanEnv = OpenEnum; + +/** + * A plan defines a set of features, pricing, and entitlements that can be attached to customers. + */ +export type UpdatePlanResponse = { + /** + * Unique identifier for the plan. + */ + id: string; + /** + * Display name of the plan. + */ + name: string; + /** + * Optional description of the plan. + */ + description: string | null; + /** + * Group identifier for organizing related plans. Plans in the same group are mutually exclusive. + */ + group: string | null; + /** + * Version number of the plan. Incremented when plan configuration changes. + */ + version: number; + /** + * Whether this is an add-on plan that can be attached alongside a main plan. + */ + addOn: boolean; + /** + * If true, this plan is automatically attached when a customer is created. Used for free plans. + */ + autoEnable: boolean; + /** + * Base recurring price for the plan. Null for free plans or usage-only plans. + */ + price: UpdatePlanPriceResponse | null; + /** + * Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature. + */ + items: Array; + /** + * Free trial configuration. If set, new customers can try this plan before being charged. + */ + freeTrial?: UpdatePlanFreeTrialResponse | undefined; + /** + * Unix timestamp (ms) when the plan was created. + */ + createdAt: number; + /** + * Environment this plan belongs to ('sandbox' or 'live'). + */ + env: UpdatePlanEnv; + /** + * Whether the plan is archived. Archived plans cannot be attached to new customers. + */ + archived: boolean; + /** + * If this is a variant, the ID of the base plan it was created from. + */ + baseVariantId: string | null; +}; + +/** @internal */ +export const UpdatePlanPriceIntervalRequest$outboundSchema: z.ZodMiniEnum< + typeof UpdatePlanPriceIntervalRequest +> = z.enum(UpdatePlanPriceIntervalRequest); + +/** @internal */ +export type UpdatePlanPriceRequest$Outbound = { + amount: number; + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const UpdatePlanPriceRequest$outboundSchema: z.ZodMiniType< + UpdatePlanPriceRequest$Outbound, + UpdatePlanPriceRequest +> = z.pipe( + z.object({ + amount: z.number(), + interval: UpdatePlanPriceIntervalRequest$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function updatePlanPriceRequestToJSON( + updatePlanPriceRequest: UpdatePlanPriceRequest, +): string { + return JSON.stringify( + UpdatePlanPriceRequest$outboundSchema.parse(updatePlanPriceRequest), + ); +} + +/** @internal */ +export const UpdatePlanResetIntervalRequest$outboundSchema: z.ZodMiniEnum< + typeof UpdatePlanResetIntervalRequest +> = z.enum(UpdatePlanResetIntervalRequest); + +/** @internal */ +export type UpdatePlanResetRequest$Outbound = { + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const UpdatePlanResetRequest$outboundSchema: z.ZodMiniType< + UpdatePlanResetRequest$Outbound, + UpdatePlanResetRequest +> = z.pipe( + z.object({ + interval: UpdatePlanResetIntervalRequest$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function updatePlanResetRequestToJSON( + updatePlanResetRequest: UpdatePlanResetRequest, +): string { + return JSON.stringify( + UpdatePlanResetRequest$outboundSchema.parse(updatePlanResetRequest), + ); +} + +/** @internal */ +export type UpdatePlanToRequest$Outbound = number | string; + +/** @internal */ +export const UpdatePlanToRequest$outboundSchema: z.ZodMiniType< + UpdatePlanToRequest$Outbound, + UpdatePlanToRequest +> = smartUnion([z.number(), z.string()]); + +export function updatePlanToRequestToJSON( + updatePlanToRequest: UpdatePlanToRequest, +): string { + return JSON.stringify( + UpdatePlanToRequest$outboundSchema.parse(updatePlanToRequest), + ); +} + +/** @internal */ +export type UpdatePlanTierRequest$Outbound = { + to: number | string; + amount: number; +}; + +/** @internal */ +export const UpdatePlanTierRequest$outboundSchema: z.ZodMiniType< + UpdatePlanTierRequest$Outbound, + UpdatePlanTierRequest +> = z.object({ + to: smartUnion([z.number(), z.string()]), + amount: z.number(), +}); + +export function updatePlanTierRequestToJSON( + updatePlanTierRequest: UpdatePlanTierRequest, +): string { + return JSON.stringify( + UpdatePlanTierRequest$outboundSchema.parse(updatePlanTierRequest), + ); +} + +/** @internal */ +export const UpdatePlanItemPriceIntervalRequest$outboundSchema: z.ZodMiniEnum< + typeof UpdatePlanItemPriceIntervalRequest +> = z.enum(UpdatePlanItemPriceIntervalRequest); + +/** @internal */ +export const UpdatePlanBillingMethodRequest$outboundSchema: z.ZodMiniEnum< + typeof UpdatePlanBillingMethodRequest +> = z.enum(UpdatePlanBillingMethodRequest); + +/** @internal */ +export type UpdatePlanItemPriceRequest$Outbound = { + amount?: number | undefined; + tiers?: Array | undefined; + interval: string; + interval_count: number; + billing_units: number; + billing_method: string; + max_purchase?: number | undefined; +}; + +/** @internal */ +export const UpdatePlanItemPriceRequest$outboundSchema: z.ZodMiniType< + UpdatePlanItemPriceRequest$Outbound, + UpdatePlanItemPriceRequest +> = z.pipe( + z.object({ + amount: z.optional(z.number()), + tiers: z.optional( + z.array(z.lazy(() => UpdatePlanTierRequest$outboundSchema)), + ), + interval: UpdatePlanItemPriceIntervalRequest$outboundSchema, + intervalCount: z._default(z.number(), 1), + billingUnits: z._default(z.number(), 1), + billingMethod: UpdatePlanBillingMethodRequest$outboundSchema, + maxPurchase: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + billingUnits: "billing_units", + billingMethod: "billing_method", + maxPurchase: "max_purchase", + }); + }), +); + +export function updatePlanItemPriceRequestToJSON( + updatePlanItemPriceRequest: UpdatePlanItemPriceRequest, +): string { + return JSON.stringify( + UpdatePlanItemPriceRequest$outboundSchema.parse(updatePlanItemPriceRequest), + ); +} + +/** @internal */ +export const UpdatePlanOnIncrease$outboundSchema: z.ZodMiniEnum< + typeof UpdatePlanOnIncrease +> = z.enum(UpdatePlanOnIncrease); + +/** @internal */ +export const UpdatePlanOnDecrease$outboundSchema: z.ZodMiniEnum< + typeof UpdatePlanOnDecrease +> = z.enum(UpdatePlanOnDecrease); + +/** @internal */ +export type UpdatePlanProration$Outbound = { + on_increase: string; + on_decrease: string; +}; + +/** @internal */ +export const UpdatePlanProration$outboundSchema: z.ZodMiniType< + UpdatePlanProration$Outbound, + UpdatePlanProration +> = z.pipe( + z.object({ + onIncrease: UpdatePlanOnIncrease$outboundSchema, + onDecrease: UpdatePlanOnDecrease$outboundSchema, + }), + z.transform((v) => { + return remap$(v, { + onIncrease: "on_increase", + onDecrease: "on_decrease", + }); + }), +); + +export function updatePlanProrationToJSON( + updatePlanProration: UpdatePlanProration, +): string { + return JSON.stringify( + UpdatePlanProration$outboundSchema.parse(updatePlanProration), + ); +} + +/** @internal */ +export const UpdatePlanExpiryDurationTypeRequest$outboundSchema: z.ZodMiniEnum< + typeof UpdatePlanExpiryDurationTypeRequest +> = z.enum(UpdatePlanExpiryDurationTypeRequest); + +/** @internal */ +export type UpdatePlanRolloverRequest$Outbound = { + max?: number | undefined; + expiry_duration_type: string; + expiry_duration_length?: number | undefined; +}; + +/** @internal */ +export const UpdatePlanRolloverRequest$outboundSchema: z.ZodMiniType< + UpdatePlanRolloverRequest$Outbound, + UpdatePlanRolloverRequest +> = z.pipe( + z.object({ + max: z.optional(z.number()), + expiryDurationType: UpdatePlanExpiryDurationTypeRequest$outboundSchema, + expiryDurationLength: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + expiryDurationType: "expiry_duration_type", + expiryDurationLength: "expiry_duration_length", + }); + }), +); + +export function updatePlanRolloverRequestToJSON( + updatePlanRolloverRequest: UpdatePlanRolloverRequest, +): string { + return JSON.stringify( + UpdatePlanRolloverRequest$outboundSchema.parse(updatePlanRolloverRequest), + ); +} + +/** @internal */ +export type UpdatePlanItemRequest$Outbound = { + feature_id: string; + included?: number | undefined; + unlimited?: boolean | undefined; + reset?: UpdatePlanResetRequest$Outbound | undefined; + price?: UpdatePlanItemPriceRequest$Outbound | undefined; + proration?: UpdatePlanProration$Outbound | undefined; + rollover?: UpdatePlanRolloverRequest$Outbound | undefined; +}; + +/** @internal */ +export const UpdatePlanItemRequest$outboundSchema: z.ZodMiniType< + UpdatePlanItemRequest$Outbound, + UpdatePlanItemRequest +> = z.pipe( + z.object({ + featureId: z.string(), + included: z.optional(z.number()), + unlimited: z.optional(z.boolean()), + reset: z.optional(z.lazy(() => UpdatePlanResetRequest$outboundSchema)), + price: z.optional(z.lazy(() => UpdatePlanItemPriceRequest$outboundSchema)), + proration: z.optional(z.lazy(() => UpdatePlanProration$outboundSchema)), + rollover: z.optional( + z.lazy(() => UpdatePlanRolloverRequest$outboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function updatePlanItemRequestToJSON( + updatePlanItemRequest: UpdatePlanItemRequest, +): string { + return JSON.stringify( + UpdatePlanItemRequest$outboundSchema.parse(updatePlanItemRequest), + ); +} + +/** @internal */ +export const UpdatePlanDurationTypeRequest$outboundSchema: z.ZodMiniEnum< + typeof UpdatePlanDurationTypeRequest +> = z.enum(UpdatePlanDurationTypeRequest); + +/** @internal */ +export type UpdatePlanFreeTrialRequest$Outbound = { + duration_length: number; + duration_type: string; + card_required: boolean; +}; + +/** @internal */ +export const UpdatePlanFreeTrialRequest$outboundSchema: z.ZodMiniType< + UpdatePlanFreeTrialRequest$Outbound, + UpdatePlanFreeTrialRequest +> = z.pipe( + z.object({ + durationLength: z.number(), + durationType: z._default( + UpdatePlanDurationTypeRequest$outboundSchema, + "month", + ), + cardRequired: z._default(z.boolean(), true), + }), + z.transform((v) => { + return remap$(v, { + durationLength: "duration_length", + durationType: "duration_type", + cardRequired: "card_required", + }); + }), +); + +export function updatePlanFreeTrialRequestToJSON( + updatePlanFreeTrialRequest: UpdatePlanFreeTrialRequest, +): string { + return JSON.stringify( + UpdatePlanFreeTrialRequest$outboundSchema.parse(updatePlanFreeTrialRequest), + ); +} + +/** @internal */ +export type UpdatePlanParams$Outbound = { + plan_id: string; + group: string; + name?: string | undefined; + description?: string | undefined; + add_on?: boolean | undefined; + auto_enable?: boolean | undefined; + price?: UpdatePlanPriceRequest$Outbound | null | undefined; + items?: Array | undefined; + free_trial?: UpdatePlanFreeTrialRequest$Outbound | null | undefined; + version?: number | undefined; + archived: boolean; + new_plan_id?: string | undefined; +}; + +/** @internal */ +export const UpdatePlanParams$outboundSchema: z.ZodMiniType< + UpdatePlanParams$Outbound, + UpdatePlanParams +> = z.pipe( + z.object({ + planId: z.string(), + group: z._default(z.string(), ""), + name: z.optional(z.string()), + description: z.optional(z.string()), + addOn: z.optional(z.boolean()), + autoEnable: z.optional(z.boolean()), + price: z.optional( + z.nullable(z.lazy(() => UpdatePlanPriceRequest$outboundSchema)), + ), + items: z.optional( + z.array(z.lazy(() => UpdatePlanItemRequest$outboundSchema)), + ), + freeTrial: z.optional( + z.nullable(z.lazy(() => UpdatePlanFreeTrialRequest$outboundSchema)), + ), + version: z.optional(z.number()), + archived: z._default(z.boolean(), false), + newPlanId: z.optional(z.string()), + }), + z.transform((v) => { + return remap$(v, { + planId: "plan_id", + addOn: "add_on", + autoEnable: "auto_enable", + freeTrial: "free_trial", + newPlanId: "new_plan_id", + }); + }), +); + +export function updatePlanParamsToJSON( + updatePlanParams: UpdatePlanParams, +): string { + return JSON.stringify( + UpdatePlanParams$outboundSchema.parse(updatePlanParams), + ); +} + +/** @internal */ +export const UpdatePlanPriceIntervalResponse$inboundSchema: z.ZodMiniType< + UpdatePlanPriceIntervalResponse, + unknown +> = openEnums.inboundSchema(UpdatePlanPriceIntervalResponse); + +/** @internal */ +export const UpdatePlanPriceDisplay$inboundSchema: z.ZodMiniType< + UpdatePlanPriceDisplay, + unknown +> = z.pipe( + z.object({ + primary_text: types.string(), + secondary_text: types.optional(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "primary_text": "primaryText", + "secondary_text": "secondaryText", + }); + }), +); + +export function updatePlanPriceDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanPriceDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanPriceDisplay' from JSON`, + ); +} + +/** @internal */ +export const UpdatePlanPriceResponse$inboundSchema: z.ZodMiniType< + UpdatePlanPriceResponse, + unknown +> = z.pipe( + z.object({ + amount: types.number(), + interval: UpdatePlanPriceIntervalResponse$inboundSchema, + interval_count: types.optional(types.number()), + display: types.optional(z.lazy(() => UpdatePlanPriceDisplay$inboundSchema)), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + }); + }), +); + +export function updatePlanPriceResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanPriceResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanPriceResponse' from JSON`, + ); +} + +/** @internal */ +export const UpdatePlanType$inboundSchema: z.ZodMiniType< + UpdatePlanType, + unknown +> = openEnums.inboundSchema(UpdatePlanType); + +/** @internal */ +export const UpdatePlanFeatureDisplay$inboundSchema: z.ZodMiniType< + UpdatePlanFeatureDisplay, + unknown +> = z.object({ + singular: types.string(), + plural: types.string(), +}); + +export function updatePlanFeatureDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanFeatureDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanFeatureDisplay' from JSON`, + ); +} + +/** @internal */ +export const UpdatePlanCreditSchema$inboundSchema: z.ZodMiniType< + UpdatePlanCreditSchema, + unknown +> = z.pipe( + z.object({ + metered_feature_id: types.string(), + credit_cost: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "metered_feature_id": "meteredFeatureId", + "credit_cost": "creditCost", + }); + }), +); + +export function updatePlanCreditSchemaFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanCreditSchema$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanCreditSchema' from JSON`, + ); +} + +/** @internal */ +export const UpdatePlanFeature$inboundSchema: z.ZodMiniType< + UpdatePlanFeature, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: z.optional(z.nullable(types.string())), + type: UpdatePlanType$inboundSchema, + display: z.optional( + z.nullable(z.lazy(() => UpdatePlanFeatureDisplay$inboundSchema)), + ), + credit_schema: z.optional( + z.nullable(z.array(z.lazy(() => UpdatePlanCreditSchema$inboundSchema))), + ), + archived: z.optional(z.nullable(types.boolean())), + }), + z.transform((v) => { + return remap$(v, { + "credit_schema": "creditSchema", + }); + }), +); + +export function updatePlanFeatureFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanFeature$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanFeature' from JSON`, + ); +} + +/** @internal */ +export const UpdatePlanResetIntervalResponse$inboundSchema: z.ZodMiniType< + UpdatePlanResetIntervalResponse, + unknown +> = openEnums.inboundSchema(UpdatePlanResetIntervalResponse); + +/** @internal */ +export const UpdatePlanResetResponse$inboundSchema: z.ZodMiniType< + UpdatePlanResetResponse, + unknown +> = z.pipe( + z.object({ + interval: UpdatePlanResetIntervalResponse$inboundSchema, + interval_count: types.optional(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + }); + }), +); + +export function updatePlanResetResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanResetResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanResetResponse' from JSON`, + ); +} + +/** @internal */ +export const UpdatePlanToResponse$inboundSchema: z.ZodMiniType< + UpdatePlanToResponse, + unknown +> = smartUnion([types.number(), types.string()]); + +export function updatePlanToResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanToResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanToResponse' from JSON`, + ); +} + +/** @internal */ +export const UpdatePlanTierResponse$inboundSchema: z.ZodMiniType< + UpdatePlanTierResponse, + unknown +> = z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), +}); + +export function updatePlanTierResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanTierResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanTierResponse' from JSON`, + ); +} + +/** @internal */ +export const UpdatePlanPriceItemIntervalResponse$inboundSchema: z.ZodMiniType< + UpdatePlanPriceItemIntervalResponse, + unknown +> = openEnums.inboundSchema(UpdatePlanPriceItemIntervalResponse); + +/** @internal */ +export const UpdatePlanBillingMethodResponse$inboundSchema: z.ZodMiniType< + UpdatePlanBillingMethodResponse, + unknown +> = openEnums.inboundSchema(UpdatePlanBillingMethodResponse); + +/** @internal */ +export const UpdatePlanItemPriceResponse$inboundSchema: z.ZodMiniType< + UpdatePlanItemPriceResponse, + unknown +> = z.pipe( + z.object({ + amount: types.optional(types.number()), + tiers: types.optional( + z.array(z.lazy(() => UpdatePlanTierResponse$inboundSchema)), + ), + interval: UpdatePlanPriceItemIntervalResponse$inboundSchema, + interval_count: types.optional(types.number()), + billing_units: types.number(), + billing_method: UpdatePlanBillingMethodResponse$inboundSchema, + max_purchase: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + "billing_units": "billingUnits", + "billing_method": "billingMethod", + "max_purchase": "maxPurchase", + }); + }), +); + +export function updatePlanItemPriceResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanItemPriceResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanItemPriceResponse' from JSON`, + ); +} + +/** @internal */ +export const UpdatePlanItemDisplay$inboundSchema: z.ZodMiniType< + UpdatePlanItemDisplay, + unknown +> = z.pipe( + z.object({ + primary_text: types.string(), + secondary_text: types.optional(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "primary_text": "primaryText", + "secondary_text": "secondaryText", + }); + }), +); + +export function updatePlanItemDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanItemDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanItemDisplay' from JSON`, + ); +} + +/** @internal */ +export const UpdatePlanExpiryDurationTypeResponse$inboundSchema: z.ZodMiniType< + UpdatePlanExpiryDurationTypeResponse, + unknown +> = openEnums.inboundSchema(UpdatePlanExpiryDurationTypeResponse); + +/** @internal */ +export const UpdatePlanRolloverResponse$inboundSchema: z.ZodMiniType< + UpdatePlanRolloverResponse, + unknown +> = z.pipe( + z.object({ + max: types.nullable(types.number()), + expiry_duration_type: UpdatePlanExpiryDurationTypeResponse$inboundSchema, + expiry_duration_length: types.optional(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "expiry_duration_type": "expiryDurationType", + "expiry_duration_length": "expiryDurationLength", + }); + }), +); + +export function updatePlanRolloverResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanRolloverResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanRolloverResponse' from JSON`, + ); +} + +/** @internal */ +export const UpdatePlanItemResponse$inboundSchema: z.ZodMiniType< + UpdatePlanItemResponse, + unknown +> = z.pipe( + z.object({ + feature_id: types.string(), + feature: types.optional(z.lazy(() => UpdatePlanFeature$inboundSchema)), + included: types.number(), + unlimited: types.boolean(), + reset: types.nullable(z.lazy(() => UpdatePlanResetResponse$inboundSchema)), + price: types.nullable( + z.lazy(() => UpdatePlanItemPriceResponse$inboundSchema), + ), + display: types.optional(z.lazy(() => UpdatePlanItemDisplay$inboundSchema)), + rollover: types.optional( + z.lazy(() => UpdatePlanRolloverResponse$inboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + "feature_id": "featureId", + }); + }), +); + +export function updatePlanItemResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanItemResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanItemResponse' from JSON`, + ); +} + +/** @internal */ +export const UpdatePlanDurationTypeResponse$inboundSchema: z.ZodMiniType< + UpdatePlanDurationTypeResponse, + unknown +> = openEnums.inboundSchema(UpdatePlanDurationTypeResponse); + +/** @internal */ +export const UpdatePlanFreeTrialResponse$inboundSchema: z.ZodMiniType< + UpdatePlanFreeTrialResponse, + unknown +> = z.pipe( + z.object({ + duration_length: types.number(), + duration_type: UpdatePlanDurationTypeResponse$inboundSchema, + card_required: types.boolean(), + }), + z.transform((v) => { + return remap$(v, { + "duration_length": "durationLength", + "duration_type": "durationType", + "card_required": "cardRequired", + }); + }), +); + +export function updatePlanFreeTrialResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanFreeTrialResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanFreeTrialResponse' from JSON`, + ); +} + +/** @internal */ +export const UpdatePlanEnv$inboundSchema: z.ZodMiniType< + UpdatePlanEnv, + unknown +> = openEnums.inboundSchema(UpdatePlanEnv); + +/** @internal */ +export const UpdatePlanResponse$inboundSchema: z.ZodMiniType< + UpdatePlanResponse, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: types.string(), + description: types.nullable(types.string()), + group: types.nullable(types.string()), + version: types.number(), + add_on: types.boolean(), + auto_enable: types.boolean(), + price: types.nullable(z.lazy(() => UpdatePlanPriceResponse$inboundSchema)), + items: z.array(z.lazy(() => UpdatePlanItemResponse$inboundSchema)), + free_trial: types.optional( + z.lazy(() => UpdatePlanFreeTrialResponse$inboundSchema), + ), + created_at: types.number(), + env: UpdatePlanEnv$inboundSchema, + archived: types.boolean(), + base_variant_id: types.nullable(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "add_on": "addOn", + "auto_enable": "autoEnable", + "free_trial": "freeTrial", + "created_at": "createdAt", + "base_variant_id": "baseVariantId", + }); + }), +); + +export function updatePlanResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/sdk/billing.ts b/packages/sdk/src/sdk/billing.ts index f1210dada..6d5e3103a 100644 --- a/packages/sdk/src/sdk/billing.ts +++ b/packages/sdk/src/sdk/billing.ts @@ -6,6 +6,7 @@ import { billingAttach } from "../funcs/billing-attach.js"; import { billingOpenCustomerPortal } from "../funcs/billing-open-customer-portal.js"; import { billingPreviewAttach } from "../funcs/billing-preview-attach.js"; import { billingPreviewUpdate } from "../funcs/billing-preview-update.js"; +import { billingSetupPayment } from "../funcs/billing-setup-payment.js"; import { billingUpdate } from "../funcs/billing-update.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; @@ -193,4 +194,18 @@ export class Billing extends ClientSDK { options, )); } + + /** + * Create a payment setup session for a customer to add or update their payment method. + */ + async setupPayment( + request: models.SetupPaymentParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(billingSetupPayment( + this, + request, + options, + )); + } } diff --git a/packages/sdk/src/sdk/plans.ts b/packages/sdk/src/sdk/plans.ts index c2146f217..05783781b 100644 --- a/packages/sdk/src/sdk/plans.ts +++ b/packages/sdk/src/sdk/plans.ts @@ -2,17 +2,156 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ +import { plansCreate } from "../funcs/plans-create.js"; +import { plansDelete } from "../funcs/plans-delete.js"; +import { plansGet } from "../funcs/plans-get.js"; import { plansList } from "../funcs/plans-list.js"; +import { plansUpdate } from "../funcs/plans-update.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; import { unwrapAsync } from "../types/fp.js"; export class Plans extends ClientSDK { + /** + * Create a plan + * + * @remarks + * Creates a new plan with optional base price and feature configurations. + * + * Use this to programmatically create pricing plans. See [How plans work](/documentation/pricing/plans) for concepts. + * + * @example + * ```typescript + * // Create a free plan with limited features + * const response = await client.plans.create({ + * planId: "free_plan", + * name: "Free", + * autoEnable: true, + * items: [{"featureId":"messages","included":100,"reset":{"interval":"month"}}], + * }); + * ``` + * + * @example + * ```typescript + * // Create a paid plan with base price and usage-based feature + * const response = await client.plans.create({ + * planId: "pro_plan", + * name: "Pro Plan", + * price: {"amount":10,"interval":"month"}, + * items: [{"featureId":"messages","included":1000,"reset":{"interval":"month"},"price":{"amount":0.01,"interval":"month","billingUnits":1,"billingMethod":"usage_based"}}], + * }); + * ``` + * + * @example + * ```typescript + * // Create a plan with prepaid seats + * const response = await client.plans.create({ + * planId: "team_plan", + * name: "Team Plan", + * price: {"amount":49,"interval":"month"}, + * items: [{"featureId":"seats","included":5,"price":{"amount":10,"interval":"month","billingUnits":1,"billingMethod":"prepaid"}}], + * }); + * ``` + * + * @example + * ```typescript + * // Create an add-on plan + * const response = await client.plans.create({ + * planId: "analytics_addon", + * name: "Advanced Analytics", + * addOn: true, + * price: {"amount":20,"interval":"month"}, + * }); + * ``` + * + * @example + * ```typescript + * // Create a plan with tiered pricing + * const response = await client.plans.create({ planId: "api_plan", name: "API Plan", items: [{"featureId":"api_calls","included":1000,"reset":{"interval":"month"},"price":{"tiers":[{"to":10000,"amount":0.001},{"to":100000,"amount":0.0005},{"to":"inf","amount":0.0001}],"interval":"month","billingUnits":1,"billingMethod":"usage_based"}}] }); + * ``` + * + * @example + * ```typescript + * // Create a plan with free trial + * const response = await client.plans.create({ + * planId: "premium_plan", + * name: "Premium", + * price: {"amount":99,"interval":"month"}, + * freeTrial: {"durationLength":14,"durationType":"day","cardRequired":true}, + * }); + * ``` + * + * @param planId - The ID of the plan to create. + * @param group - Group identifier for organizing related plans. Plans in the same group are mutually exclusive. (optional) + * @param name - Display name of the plan. + * @param description - Optional description of the plan. (optional) + * @param addOn - If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. (optional) + * @param autoEnable - If true, plan is automatically attached when a customer is created. Use for free tiers. (optional) + * @param price - Base recurring price for the plan. Omit for free or usage-only plans. (optional) + * @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional) + * @param freeTrial - Free trial configuration. Customers can try this plan before being charged. (optional) + * + * @returns The created plan object. + */ + async create( + request: models.CreatePlanParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(plansCreate( + this, + request, + options, + )); + } + + /** + * Get a plan + * + * @remarks + * Retrieves a single plan by its ID. + * + * Use this to fetch the full configuration of a specific plan, including its features and pricing. + * + * @example + * ```typescript + * // Get a plan by ID + * const response = await client.plans.get({ planId: "pro_plan" }); + * ``` + * + * @example + * ```typescript + * // Get a specific version of a plan + * const response = await client.plans.get({ planId: "pro_plan", version: 2 }); + * ``` + * + * @param planId - The ID of the plan to retrieve. + * @param version - The version of the plan to get. Defaults to the latest version. (optional) + * + * @returns The plan object with its full configuration. + */ + async get( + request: models.GetPlanParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(plansGet( + this, + request, + options, + )); + } + /** * List all plans + * + * @remarks + * Lists all plans in the current environment. + * + * Use this to retrieve all plans for displaying pricing pages or managing plan configurations. + * + * @returns A list of all plans with their pricing and feature configurations. */ async list( - request?: models.ListPlansRequest | undefined, + request?: models.ListPlansParams | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(plansList( @@ -21,4 +160,101 @@ export class Plans extends ClientSDK { options, )); } + + /** + * Update a plan + * + * @remarks + * Updates an existing plan. Creates a new version unless `disableVersion` is set. + * + * Use this to modify plan properties, pricing, or feature configurations. See [Adding features to plans](/documentation/pricing/plan-features) for item configuration. + * + * @example + * ```typescript + * // Update plan name and price + * const response = await client.plans.update({ planId: "pro_plan", name: "Pro Plan (Updated)", price: {"amount":15,"interval":"month"} }); + * ``` + * + * @example + * ```typescript + * // Add a feature to an existing plan + * const response = await client.plans.update({ planId: "pro_plan", items: [{"featureId":"messages","included":1000,"reset":{"interval":"month"}},{"featureId":"storage","included":10,"reset":{"interval":"month"}}] }); + * ``` + * + * @example + * ```typescript + * // Remove the base price (make usage-only) + * const response = await client.plans.update({ planId: "pro_plan", price: null }); + * ``` + * + * @example + * ```typescript + * // Archive a plan + * const response = await client.plans.update({ planId: "old_plan", archived: true }); + * ``` + * + * @example + * ```typescript + * // Update feature's included amount + * const response = await client.plans.update({ planId: "pro_plan", items: [{"featureId":"messages","included":2000,"reset":{"interval":"month"}}] }); + * ``` + * + * @param planId - The ID of the plan to update. + * @param group - Group identifier for organizing related plans. Plans in the same group are mutually exclusive. (optional) + * @param name - Display name of the plan. (optional) + * @param addOn - Whether the plan is an add-on. (optional) + * @param autoEnable - Whether the plan is automatically enabled. (optional) + * @param price - The price of the plan. Set to null to remove the base price. (optional) + * @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional) + * @param freeTrial - The free trial of the plan. Set to null to remove the free trial. (optional) + * @param newPlanId - The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. (optional) + * + * @returns The updated plan object. + */ + async update( + request: models.UpdatePlanParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(plansUpdate( + this, + request, + options, + )); + } + + /** + * Delete a plan + * + * @remarks + * Deletes a plan by its ID. + * + * Use this to permanently remove a plan. Plans with active customers cannot be deleted - archive them instead. + * + * @example + * ```typescript + * // Delete a plan + * const response = await client.plans.delete({ planId: "unused_plan" }); + * ``` + * + * @example + * ```typescript + * // Delete all versions of a plan + * const response = await client.plans.delete({ planId: "legacy_plan", allVersions: true }); + * ``` + * + * @param planId - The ID of the plan to delete. + * @param allVersions - If true, deletes all versions of the plan. Otherwise, only deletes the latest version. (optional) + * + * @returns A success flag indicating the plan was deleted. + */ + async delete( + request: models.DeletePlanParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(plansDelete( + this, + request, + options, + )); + } } diff --git a/server/src/external/autumn/autumnRpcCli.ts b/server/src/external/autumn/autumnRpcCli.ts new file mode 100644 index 000000000..c92207de8 --- /dev/null +++ b/server/src/external/autumn/autumnRpcCli.ts @@ -0,0 +1,136 @@ +/** biome-ignore-all lint/suspicious/noExplicitAny: RPC test client needs flexible payload typing */ +import dotenv from "dotenv"; + +dotenv.config(); + +import { ErrCode, type OrgConfig } from "@autumn/shared"; +import AutumnError from "./autumnCli.js"; + +export class AutumnRpcCli { + private apiKey: string; + public headers: Record; + public baseUrl: string; + + constructor({ + apiKey, + secretKey, + baseUrl, + version, + orgConfig, + liveUrl = false, + }: { + apiKey?: string; + secretKey?: string; + baseUrl?: string; + version?: string; + orgConfig?: Partial; + liveUrl?: boolean; + } = {}) { + this.apiKey = + apiKey || secretKey || process.env.UNIT_TEST_AUTUMN_SECRET_KEY || ""; + + this.headers = { + Authorization: `Bearer ${this.apiKey}`, + "Content-Type": "application/json", + }; + + if (version) { + this.headers["x-api-version"] = version; + } + + if (orgConfig) { + this.headers["org-config"] = JSON.stringify(orgConfig); + } + + this.baseUrl = + baseUrl || + (liveUrl ? "https://api.useautumn.com/v1" : "http://localhost:8080/v1"); + } + + private resolvePath(path: string) { + return path.startsWith("/") ? path : `/${path}`; + } + + async post(path: string, body: any) { + const response = await fetch(`${this.baseUrl}${this.resolvePath(path)}`, { + method: "POST", + headers: this.headers, + body: JSON.stringify(body), + }); + + if (response.status !== 200) { + // Handle rate limit errors + if (response.status === 429) { + throw new AutumnError({ + message: "request failed, rate limit exceeded", + code: "rate_limit_exceeded", + }); + } + + let error: any; + try { + error = await response.json(); + } catch (error) { + throw new AutumnError({ + message: `request failed, error: ${error}`, + code: ErrCode.InternalError, + }); + } + + throw new AutumnError({ + message: error.message, + code: error.code, + }); + } + + return response.json(); + } + + rpc = { + call: async ({ + method, + body, + }: { + method: string; + body: any; + }): Promise => { + return (await this.post(method, body)) as T; + }, + }; + + plans = { + create: async ( + plan: TInput, + ): Promise => { + return await this.post("/plans.create", plan); + }, + + get: async (planId: string): Promise => { + return await this.post("/plans.get", { + plan_id: planId, + }); + }, + + update: async ( + planId: string, + updates: TInput, + ): Promise => { + return await this.post("/plans.update", { + ...(updates as Record), + plan_id: planId, + }); + }, + + delete: async ( + planId: string, + { allVersions = false }: { allVersions?: boolean } = {}, + ): Promise<{ success: boolean }> => { + return await this.post("/plans.delete", { + plan_id: planId, + all_versions: allVersions, + }); + }, + }; +} + +export default AutumnRpcCli; diff --git a/server/src/honoMiddlewares/refreshProductsCacheMiddleware.ts b/server/src/honoMiddlewares/refreshProductsCacheMiddleware.ts index 57438a7a9..f50d81dfe 100644 --- a/server/src/honoMiddlewares/refreshProductsCacheMiddleware.ts +++ b/server/src/honoMiddlewares/refreshProductsCacheMiddleware.ts @@ -19,6 +19,11 @@ const productRoutes = [ { method: "POST", url: "/plans/:plan_id" }, { method: "PATCH", url: "/plans/:plan_id" }, { method: "DELETE", url: "/plans/:plan_id" }, + + // RPC plan routes + { method: "POST", url: "/plans.create" }, + { method: "POST", url: "/plans.update" }, + { method: "POST", url: "/plans.delete" }, ]; /** diff --git a/server/src/internal/misc/configs/handlers/handlePushOrganisationConfiguration.ts b/server/src/internal/misc/configs/handlers/handlePushOrganisationConfiguration.ts index 9da072ef4..b63f7709f 100644 --- a/server/src/internal/misc/configs/handlers/handlePushOrganisationConfiguration.ts +++ b/server/src/internal/misc/configs/handlers/handlePushOrganisationConfiguration.ts @@ -10,7 +10,7 @@ import type { DrizzleCli } from "@/db/initDrizzle"; import { createRoute } from "@/honoMiddlewares/routeHandler"; import { FeatureService } from "@/internal/features/FeatureService"; import { createFeature } from "@/internal/features/featureActions/createFeature"; -import { createProduct } from "@/internal/products/handlers/productActions/createProduct"; +import { createProduct } from "@/internal/product/actions/createProduct"; import { ProductService } from "@/internal/products/ProductService"; import { invalidateProductsCache } from "@/internal/products/productCacheUtils"; diff --git a/server/src/internal/misc/pricingAgent/handlers/handleSyncPreviewPricing.ts b/server/src/internal/misc/pricingAgent/handlers/handleSyncPreviewPricing.ts index 98feadbab..48b9a585a 100644 --- a/server/src/internal/misc/pricingAgent/handlers/handleSyncPreviewPricing.ts +++ b/server/src/internal/misc/pricingAgent/handlers/handleSyncPreviewPricing.ts @@ -13,7 +13,7 @@ import { CusService } from "@/internal/customers/CusService.js"; import { FeatureService } from "@/internal/features/FeatureService.js"; import { createFeature } from "@/internal/features/featureActions/createFeature.js"; import { OrgService } from "@/internal/orgs/OrgService.js"; -import { createProduct } from "@/internal/products/handlers/productActions/createProduct.js"; +import { createProduct } from "@/internal/product/actions/createProduct.js"; import { ProductService } from "@/internal/products/ProductService.js"; import { invalidateProductsCache } from "@/internal/products/productCacheUtils.js"; import { buildPreviewOrgSlug } from "./handleSetupPreviewOrg.js"; diff --git a/server/src/internal/products/handlers/productActions/createProduct.ts b/server/src/internal/product/actions/createProduct.ts similarity index 80% rename from server/src/internal/products/handlers/productActions/createProduct.ts rename to server/src/internal/product/actions/createProduct.ts index fe191f1e0..52065f4df 100644 --- a/server/src/internal/products/handlers/productActions/createProduct.ts +++ b/server/src/internal/product/actions/createProduct.ts @@ -9,15 +9,15 @@ import { ProductAlreadyExistsError } from "@autumn/shared"; import type { AutumnContext } from "@/honoUtils/HonoEnv.js"; import { JobName } from "@/queue/JobName.js"; import { addTaskToQueue } from "@/queue/queueUtils.js"; -import { getEntsWithFeature } from "../../entitlements/entitlementUtils.js"; +import { getEntsWithFeature } from "@/internal/products/entitlements/entitlementUtils.js"; import { handleNewFreeTrial, validateOneOffTrial, -} from "../../free-trials/freeTrialUtils.js"; -import { ProductService } from "../../ProductService.js"; -import { handleNewProductItems } from "../../product-items/productItemUtils/handleNewProductItems.js"; -import { getProductResponse } from "../../productUtils/productResponseUtils/getProductResponse.js"; -import { constructProduct, initProductInStripe } from "../../productUtils.js"; +} from "@/internal/products/free-trials/freeTrialUtils.js"; +import { ProductService } from "@/internal/products/ProductService.js"; +import { handleNewProductItems } from "@/internal/products/product-items/productItemUtils/handleNewProductItems.js"; +import { getProductResponse } from "@/internal/products/productUtils/productResponseUtils/getProductResponse.js"; +import { constructProduct, initProductInStripe } from "@/internal/products/productUtils.js"; import { validateDefaultFlag } from "./validateDefaultFlag.js"; export const createProduct = async ({ diff --git a/server/src/internal/product/actions/deleteProduct.ts b/server/src/internal/product/actions/deleteProduct.ts new file mode 100644 index 000000000..2e7d4b125 --- /dev/null +++ b/server/src/internal/product/actions/deleteProduct.ts @@ -0,0 +1,66 @@ +import { ProductNotFoundError, RecaseError } from "@autumn/shared"; +import type { AutumnContext } from "@/honoUtils/HonoEnv.js"; +import { CusProdReadService } from "@/internal/customers/cusProducts/CusProdReadService.js"; +import { ProductService } from "@/internal/products/ProductService.js"; + +export const deleteProduct = async ({ + ctx, + productId, + allVersions = false, +}: { + ctx: AutumnContext; + productId: string; + allVersions?: boolean; +}) => { + const { db, org, env } = ctx; + + const product = await ProductService.get({ + db, + id: productId, + orgId: org.id, + env, + }); + + if (!product) { + throw new ProductNotFoundError({ productId: productId }); + } + + const [latestCounts, allCounts] = await Promise.all([ + CusProdReadService.getCounts({ + db, + internalProductId: product.internal_id, + }), + CusProdReadService.getCountsForAllVersions({ + db, + productId: productId, + orgId: org.id, + env, + }), + ]); + + const cusProdCount = allVersions ? allCounts.all : latestCounts.all; + + if (cusProdCount > 0) { + throw new RecaseError({ + message: `Product ${productId} has ${cusProdCount} customers (expired or active) on it and therefore cannot be deleted`, + }); + } + + if (allVersions) { + await ProductService.deleteByProductId({ + db, + productId: productId, + orgId: org.id, + env, + }); + } else { + await ProductService.deleteByInternalId({ + db, + internalId: product.internal_id, + orgId: org.id, + env, + }); + } + + return { success: true }; +}; diff --git a/server/src/internal/products/handlers/productActions/updateProduct.ts b/server/src/internal/product/actions/updateProduct.ts similarity index 81% rename from server/src/internal/products/handlers/productActions/updateProduct.ts rename to server/src/internal/product/actions/updateProduct.ts index 71d24c009..1141d0d34 100644 --- a/server/src/internal/products/handlers/productActions/updateProduct.ts +++ b/server/src/internal/product/actions/updateProduct.ts @@ -1,5 +1,6 @@ import { type FreeTrial, + type FullProduct, mapToProductV2, notNullish, ProductNotFoundError, @@ -11,19 +12,19 @@ import { } from "@autumn/shared"; import type { AutumnContext } from "@/honoUtils/HonoEnv.js"; import { CusProductService } from "@/internal/customers/cusProducts/CusProductService.js"; -import { RewardProgramService } from "@/internal/rewards/RewardProgramService.js"; -import { JobName } from "@/queue/JobName.js"; -import { addTaskToQueue } from "@/queue/queueUtils.js"; import { handleNewFreeTrial, validateOneOffTrial, -} from "../../free-trials/freeTrialUtils.js"; -import { ProductService } from "../../ProductService.js"; -import { handleNewProductItems } from "../../product-items/productItemUtils/handleNewProductItems.js"; -import { getProductResponse } from "../../productUtils/productResponseUtils/getProductResponse.js"; -import { initProductInStripe } from "../../productUtils.js"; -import { handleUpdateProductDetails } from "../handleUpdateProduct/updateProductDetails.js"; -import { handleVersionProductV2 } from "../handleVersionProduct.js"; +} from "@/internal/products/free-trials/freeTrialUtils.js"; +import { handleUpdateProductDetails } from "@/internal/products/handlers/handleUpdatePlan/updateProductDetails.js"; +import { handleVersionProductV2 } from "@/internal/products/handlers/handleVersionProduct.js"; +import { ProductService } from "@/internal/products/ProductService.js"; +import { handleNewProductItems } from "@/internal/products/product-items/productItemUtils/handleNewProductItems.js"; +import { getProductResponse } from "@/internal/products/productUtils/productResponseUtils/getProductResponse.js"; +import { initProductInStripe } from "@/internal/products/productUtils.js"; +import { RewardProgramService } from "@/internal/rewards/RewardProgramService.js"; +import { JobName } from "@/queue/JobName.js"; +import { addTaskToQueue } from "@/queue/queueUtils.js"; import { validateDefaultFlag } from "./validateDefaultFlag.js"; interface UpdateProductParams { @@ -35,25 +36,30 @@ interface UpdateProductParams { disable_version?: boolean; }; updates: UpdateProductV2Params; + initialFullProduct?: FullProduct; } export const updateProduct = async ({ ctx, query, productId, updates, + initialFullProduct, }: UpdateProductParams) => { const { db, org, env, features, logger } = ctx; const { version, upsert, disable_version } = query; - const [fullProduct, rewardPrograms, _defaultProds] = await Promise.all([ - ProductService.getFull({ + const getFullProduct = async () => { + if (initialFullProduct) return initialFullProduct; + return ProductService.getFull({ db, idOrInternalId: productId, orgId: org.id, env, - version: version, - allowNotFound: upsert === true, - }), + }); + }; + + const [fullProduct, rewardPrograms, _defaultProds] = await Promise.all([ + getFullProduct(), RewardProgramService.getByProductId({ db, productIds: [productId], @@ -160,10 +166,12 @@ export const updateProduct = async ({ }); } + const latestProductId = updates.id || fullProduct.id; + // New full product const newFullProduct = await ProductService.getFull({ db, - idOrInternalId: fullProduct.id, + idOrInternalId: latestProductId, orgId: org.id, env, }); @@ -202,7 +210,7 @@ export const updateProduct = async ({ jobName: JobName.RewardMigration, payload: { oldPrices: fullProduct.prices, - productId: fullProduct.id, + productId: latestProductId, orgId: org.id, env, }, diff --git a/server/src/internal/products/handlers/productActions/validateDefaultFlag.ts b/server/src/internal/product/actions/validateDefaultFlag.ts similarity index 91% rename from server/src/internal/products/handlers/productActions/validateDefaultFlag.ts rename to server/src/internal/product/actions/validateDefaultFlag.ts index b1ac2aa2d..976b81fe7 100644 --- a/server/src/internal/products/handlers/productActions/validateDefaultFlag.ts +++ b/server/src/internal/product/actions/validateDefaultFlag.ts @@ -8,13 +8,13 @@ import { RecaseError, type UpdateProductV2Params, } from "@autumn/shared"; -import type { AutumnContext } from "../../../../honoUtils/HonoEnv"; -import { ProductService } from "../../ProductService"; +import type { AutumnContext } from "@/honoUtils/HonoEnv.js"; +import { ProductService } from "@/internal/products/ProductService.js"; import { getGroupToDefaults, isFreeProduct, isOneOff, -} from "../../productUtils"; +} from "@/internal/products/productUtils.js"; const disableCurrentDefault = async ({ ctx, @@ -108,7 +108,7 @@ export const validateDefaultFlag = async ({ if (isOneOffProduct) { throw new RecaseError({ - message: `Cannot make a plan default if it has prices on it.`, + message: `Cannot make a plan auto-enable if it has prices on it.`, }); } @@ -129,7 +129,7 @@ export const validateDefaultFlag = async ({ if (defaultTrial) return { type: "default_trial" }; throw new RecaseError({ - message: `Cannot make a plan default if it has prices on it.`, + message: `Cannot make a plan auto-enable if it has prices on it.`, }); }; diff --git a/server/src/internal/products/handlers/handleCopyEnvironment/handleCopyProducts.ts b/server/src/internal/products/handlers/handleCopyEnvironment/handleCopyProducts.ts index b0a50406a..aedb19bfd 100644 --- a/server/src/internal/products/handlers/handleCopyEnvironment/handleCopyProducts.ts +++ b/server/src/internal/products/handlers/handleCopyEnvironment/handleCopyProducts.ts @@ -8,8 +8,8 @@ import { import type { AutumnContext } from "@/honoUtils/HonoEnv.js"; import { FeatureService } from "@/internal/features/FeatureService.js"; import { ProductService } from "../../ProductService.js"; -import { createProduct } from "../productActions/createProduct.js"; -import { updateProduct } from "../productActions/updateProduct.js"; +import { createProduct } from "../../../product/actions/createProduct.js"; +import { updateProduct } from "../../../product/actions/updateProduct.js"; const conformProductToSchema = ( product: ProductV2, diff --git a/server/src/internal/products/handlers/handleCreatePlan.ts b/server/src/internal/products/handlers/handleCreateProduct/handleCreatePlan.ts similarity index 86% rename from server/src/internal/products/handlers/handleCreatePlan.ts rename to server/src/internal/products/handlers/handleCreateProduct/handleCreatePlan.ts index 096d0ce10..d377bb107 100644 --- a/server/src/internal/products/handlers/handleCreatePlan.ts +++ b/server/src/internal/products/handlers/handleCreateProduct/handleCreatePlan.ts @@ -18,17 +18,17 @@ import { createRoute } from "@/honoMiddlewares/routeHandler.js"; import { JobName } from "@/queue/JobName.js"; import { addTaskToQueue } from "@/queue/queueUtils.js"; import { captureOrgEvent } from "@/utils/posthog.js"; -import { getEntsWithFeature } from "../entitlements/entitlementUtils.js"; +import { getEntsWithFeature } from "../../entitlements/entitlementUtils.js"; import { handleNewFreeTrial, validateOneOffTrial, -} from "../free-trials/freeTrialUtils.js"; +} from "../../free-trials/freeTrialUtils.js"; -import { ProductService } from "../ProductService.js"; -import { handleNewProductItems } from "../product-items/productItemUtils/handleNewProductItems.js"; -import { getPlanResponse } from "../productUtils/productResponseUtils/getPlanResponse.js"; -import { constructProduct, initProductInStripe } from "../productUtils.js"; -import { validateDefaultFlag } from "./productActions/validateDefaultFlag.js"; +import { ProductService } from "../../ProductService.js"; +import { handleNewProductItems } from "../../product-items/productItemUtils/handleNewProductItems.js"; +import { getPlanResponse } from "../../productUtils/productResponseUtils/getPlanResponse.js"; +import { constructProduct, initProductInStripe } from "../../productUtils.js"; +import { validateDefaultFlag } from "../../../product/actions/validateDefaultFlag.js"; /** * Route: POST /products - Create a product diff --git a/server/src/internal/products/handlers/handleCreateProduct/handleCreatePlanV2.ts b/server/src/internal/products/handlers/handleCreateProduct/handleCreatePlanV2.ts new file mode 100644 index 000000000..edf39a732 --- /dev/null +++ b/server/src/internal/products/handlers/handleCreateProduct/handleCreatePlanV2.ts @@ -0,0 +1,48 @@ +import { + AffectedResource, + apiPlan, + CreatePlanParamsV2Schema, + type CreateProductV2Params, +} from "@autumn/shared"; +import { createRoute } from "@/honoMiddlewares/routeHandler.js"; +import { createProduct } from "../../../product/actions/createProduct.js"; +import { ProductService } from "../../ProductService.js"; +import { getPlanResponse } from "../../productUtils/productResponseUtils/getPlanResponse.js"; + +export const handleCreatePlanV2 = createRoute({ + body: CreatePlanParamsV2Schema, + resource: AffectedResource.Product, + handler: async (c) => { + const body = c.req.valid("json"); + const ctx = c.get("ctx"); + + const createParams = apiPlan.map.paramsV1ToProductV2({ + ctx, + params: { + id: body.plan_id, + ...body, + }, + }) as CreateProductV2Params; + + await createProduct({ + ctx, + data: createParams, + }); + + const [fullProduct] = await Promise.all([ + ProductService.getFull({ + db: ctx.db, + idOrInternalId: body.plan_id, + orgId: ctx.org.id, + env: ctx.env, + }), + ]); + + const latestPlan = await getPlanResponse({ + product: fullProduct, + features: ctx.features, + }); + + return c.json(latestPlan); + }, +}); diff --git a/server/src/internal/products/handlers/handleDeletePlan/handleDeletePlanV1.ts b/server/src/internal/products/handlers/handleDeletePlan/handleDeletePlanV1.ts new file mode 100644 index 000000000..b98abc871 --- /dev/null +++ b/server/src/internal/products/handlers/handleDeletePlan/handleDeletePlanV1.ts @@ -0,0 +1,29 @@ +import { AffectedResource } from "@autumn/shared"; +import { z } from "zod/v4"; +import { createRoute } from "@/honoMiddlewares/routeHandler.js"; +import { deleteProduct } from "../../../product/actions/deleteProduct.js"; + +const DeletePlanParamsSchema = z.object({ + product_id: z.string(), +}); + +const DeletePlanQuerySchema = z.object({ + all_versions: z.boolean().default(false), +}); + +export const handleDeletePlanV1 = createRoute({ + params: DeletePlanParamsSchema, + query: DeletePlanQuerySchema, + resource: AffectedResource.Product, + handler: async (c) => { + const { product_id } = c.req.param(); + const { all_versions } = c.req.valid("query"); + const { success } = await deleteProduct({ + ctx: c.get("ctx"), + productId: product_id, + allVersions: all_versions, + }); + + return c.json({ success }); + }, +}); diff --git a/server/src/internal/products/handlers/handleDeletePlan/handleDeletePlanV2.ts b/server/src/internal/products/handlers/handleDeletePlan/handleDeletePlanV2.ts new file mode 100644 index 000000000..701f55017 --- /dev/null +++ b/server/src/internal/products/handlers/handleDeletePlan/handleDeletePlanV2.ts @@ -0,0 +1,18 @@ +import { AffectedResource, DeletePlanParamsV2Schema } from "@autumn/shared"; +import { createRoute } from "@/honoMiddlewares/routeHandler.js"; +import { deleteProduct } from "../../../product/actions/deleteProduct.js"; + +export const handleDeletePlanV2 = createRoute({ + body: DeletePlanParamsV2Schema, + resource: AffectedResource.Product, + handler: async (c) => { + const { plan_id, all_versions } = c.req.valid("json"); + const { success } = await deleteProduct({ + ctx: c.get("ctx"), + productId: plan_id, + allVersions: all_versions, + }); + + return c.json({ success }); + }, +}); diff --git a/server/src/internal/products/handlers/handleDeleteProduct.ts b/server/src/internal/products/handlers/handleDeleteProduct.ts deleted file mode 100644 index 1b56b1677..000000000 --- a/server/src/internal/products/handlers/handleDeleteProduct.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { - AffectedResource, - ProductNotFoundError, - RecaseError, -} from "@autumn/shared"; -import { z } from "zod/v4"; -import { createRoute } from "@/honoMiddlewares/routeHandler.js"; -import { CusProdReadService } from "@/internal/customers/cusProducts/CusProdReadService.js"; -import { ProductService } from "@/internal/products/ProductService.js"; - -const DeleteProductParamsSchema = z.object({ - product_id: z.string(), -}); - -const DeleteProductQuerySchema = z.object({ - all_versions: z.boolean().default(false), -}); - -export const handleDeleteProduct = createRoute({ - params: DeleteProductParamsSchema, - query: DeleteProductQuerySchema, - resource: AffectedResource.Product, - handler: async (c) => { - const { product_id } = c.req.param(); - const { all_versions } = c.req.valid("query"); - const { db, org, env } = c.get("ctx"); - - const product = await ProductService.get({ - db, - id: product_id, - orgId: org.id, - env, - }); - - if (!product) { - throw new ProductNotFoundError({ productId: product_id }); - } - - const [latestCounts, allCounts] = await Promise.all([ - CusProdReadService.getCounts({ - db, - internalProductId: product.internal_id, - }), - CusProdReadService.getCountsForAllVersions({ - db, - productId: product_id, - orgId: org.id, - env, - }), - ]); - - const deleteAllVersions = all_versions === true; - const cusProdCount = deleteAllVersions ? allCounts.all : latestCounts.all; - - if (cusProdCount > 0) { - throw new RecaseError({ - message: `Product ${product_id} has ${cusProdCount} customers (expired or active) on it and therefore cannot be deleted`, - }); - } - - // 2. Delete prices, entitlements, and product - if (deleteAllVersions) { - await ProductService.deleteByProductId({ - db, - productId: product_id, - orgId: org.id, - env, - }); - } else { - await ProductService.deleteByInternalId({ - db, - internalId: product.internal_id, - orgId: org.id, - env, - }); - } - - return c.json({ success: true }); - }, -}); diff --git a/server/src/internal/products/handlers/handleGetPlan.ts b/server/src/internal/products/handlers/handleGetPlan/handleGetPlanV1.ts similarity index 91% rename from server/src/internal/products/handlers/handleGetPlan.ts rename to server/src/internal/products/handlers/handleGetPlan/handleGetPlanV1.ts index e89bc52cd..4ed76a6b5 100644 --- a/server/src/internal/products/handlers/handleGetPlan.ts +++ b/server/src/internal/products/handlers/handleGetPlan/handleGetPlanV1.ts @@ -9,7 +9,7 @@ import { import { z } from "zod/v4"; import { createRoute } from "@/honoMiddlewares/routeHandler.js"; import { ProductService } from "@/internal/products/ProductService.js"; -import { getPlanResponse } from "../productUtils/productResponseUtils/getPlanResponse.js"; +import { getPlanResponse } from "../../productUtils/productResponseUtils/getPlanResponse.js"; const GetProductQuerySchema = z.object({ schemaVersion: z.string().optional(), @@ -18,7 +18,7 @@ const GetProductQuerySchema = z.object({ /** * Route: GET /products/:product_id - Get a product by ID */ -export const handleGetPlan = createRoute({ +export const handleGetPlanV1 = createRoute({ query: GetProductQuerySchema, resource: AffectedResource.Product, handler: async (c) => { diff --git a/server/src/internal/products/handlers/handleGetPlan/handleGetPlanV2.ts b/server/src/internal/products/handlers/handleGetPlan/handleGetPlanV2.ts new file mode 100644 index 000000000..f5143244f --- /dev/null +++ b/server/src/internal/products/handlers/handleGetPlan/handleGetPlanV2.ts @@ -0,0 +1,28 @@ +import { AffectedResource, GetPlanParamsV0Schema } from "@autumn/shared"; +import { createRoute } from "@/honoMiddlewares/routeHandler.js"; +import { ProductService } from "../../ProductService.js"; +import { getPlanResponse } from "../../productUtils/productResponseUtils/getPlanResponse.js"; + +export const handleGetPlanV2 = createRoute({ + body: GetPlanParamsV0Schema, + resource: AffectedResource.Product, + handler: async (c) => { + const { plan_id, version } = c.req.valid("json"); + const ctx = c.get("ctx"); + + const fullProduct = await ProductService.getFull({ + db: ctx.db, + idOrInternalId: plan_id, + orgId: ctx.org.id, + env: ctx.env, + version: version, + }); + + const latestPlan = await getPlanResponse({ + product: fullProduct, + features: ctx.features, + }); + + return c.json(latestPlan); + }, +}); diff --git a/server/src/internal/products/handlers/handleUpdateProduct/handleUpdatePlan.ts b/server/src/internal/products/handlers/handleUpdatePlan/handleUpdatePlanV1.ts similarity index 97% rename from server/src/internal/products/handlers/handleUpdateProduct/handleUpdatePlan.ts rename to server/src/internal/products/handlers/handleUpdatePlan/handleUpdatePlanV1.ts index ceb939e46..8b69d045e 100644 --- a/server/src/internal/products/handlers/handleUpdateProduct/handleUpdatePlan.ts +++ b/server/src/internal/products/handlers/handleUpdatePlan/handleUpdatePlanV1.ts @@ -24,6 +24,7 @@ import { CusProductService } from "@/internal/customers/cusProducts/CusProductSe import { RewardProgramService } from "@/internal/rewards/RewardProgramService.js"; import { JobName } from "@/queue/JobName.js"; import { addTaskToQueue } from "@/queue/queueUtils.js"; +import { validateDefaultFlag } from "../../../product/actions/validateDefaultFlag.js"; import { handleNewFreeTrial, validateOneOffTrial, @@ -33,10 +34,9 @@ import { handleNewProductItems } from "../../product-items/productItemUtils/hand import { getPlanResponse } from "../../productUtils/productResponseUtils/getPlanResponse.js"; import { initProductInStripe } from "../../productUtils.js"; import { handleVersionProductV2 } from "../handleVersionProduct.js"; -import { validateDefaultFlag } from "../productActions/validateDefaultFlag.js"; import { handleUpdateProductDetails } from "./updateProductDetails.js"; -export const handleUpdatePlan = createRoute({ +export const handleUpdatePlanV1 = createRoute({ versionedBody: { latest: UpdatePlanParamsV1Schema, [ApiVersion.V1_Beta]: UpdateProductV2ParamsSchema, diff --git a/server/src/internal/products/handlers/handleUpdatePlan/handleUpdatePlanV2.ts b/server/src/internal/products/handlers/handleUpdatePlan/handleUpdatePlanV2.ts new file mode 100644 index 000000000..8a78ed468 --- /dev/null +++ b/server/src/internal/products/handlers/handleUpdatePlan/handleUpdatePlanV2.ts @@ -0,0 +1,60 @@ +import { + AffectedResource, + apiPlan, + UpdatePlanParamsV2Schema, + type UpdateProductV2Params, +} from "@autumn/shared"; +import { createRoute } from "@/honoMiddlewares/routeHandler.js"; +import { updateProduct } from "../../../product/actions/updateProduct.js"; +import { ProductService } from "../../ProductService.js"; +import { getPlanResponse } from "../../productUtils/productResponseUtils/getPlanResponse.js"; + +export const handleUpdatePlanV2 = createRoute({ + body: UpdatePlanParamsV2Schema, + resource: AffectedResource.Product, + handler: async (c) => { + const body = c.req.valid("json"); + + const { plan_id, new_plan_id, ...planParams } = body; + const ctx = c.get("ctx"); + + const initialFullProduct = await ProductService.getFull({ + db: ctx.db, + idOrInternalId: plan_id, + orgId: ctx.org.id, + env: ctx.env, + }); + + const updateProductV2Params = apiPlan.map.paramsV1ToProductV2({ + ctx, + currentFullProduct: initialFullProduct, + params: { + id: new_plan_id, + ...planParams, + }, + }) as UpdateProductV2Params; + + await updateProduct({ + ctx, + productId: plan_id, + query: {}, + updates: updateProductV2Params, + initialFullProduct, + }); + + const latestPlanId = new_plan_id || plan_id; + const latestFullProduct = await ProductService.getFull({ + db: ctx.db, + idOrInternalId: latestPlanId, + orgId: ctx.org.id, + env: ctx.env, + }); + + const latestPlan = await getPlanResponse({ + product: latestFullProduct, + features: ctx.features, + }); + + return c.json(latestPlan); + }, +}); diff --git a/server/src/internal/products/handlers/handleUpdateProduct/updateProductDetails.ts b/server/src/internal/products/handlers/handleUpdatePlan/updateProductDetails.ts similarity index 100% rename from server/src/internal/products/handlers/handleUpdateProduct/updateProductDetails.ts rename to server/src/internal/products/handlers/handleUpdatePlan/updateProductDetails.ts diff --git a/server/src/internal/products/planRouter.ts b/server/src/internal/products/planRouter.ts new file mode 100644 index 000000000..fc194853c --- /dev/null +++ b/server/src/internal/products/planRouter.ts @@ -0,0 +1,56 @@ +import { Hono } from "hono"; +import type { HonoEnv } from "@/honoUtils/HonoEnv.js"; +import { handlePlanHasCustomersV2 } from "@/internal/products/handlers/handlePlanHasCustomersV2.js"; +import { handleCopyProductV2 } from "./handlers/handleCopyProduct/handleCopyProductV2.js"; +import { handleCreatePlan } from "./handlers/handleCreateProduct/handleCreatePlan.js"; +import { handleCreatePlanV2 } from "./handlers/handleCreateProduct/handleCreatePlanV2.js"; +import { handleDeletePlanV1 } from "./handlers/handleDeletePlan/handleDeletePlanV1.js"; +import { handleDeletePlanV2 } from "./handlers/handleDeletePlan/handleDeletePlanV2.js"; +import { handleGetPlanV1 } from "./handlers/handleGetPlan/handleGetPlanV1.js"; +import { handleGetPlanV2 } from "./handlers/handleGetPlan/handleGetPlanV2.js"; +import { handleGetPlanDeleteInfo } from "./handlers/handleGetPlanDeleteInfo.js"; +import { handleListPlansV2 } from "./handlers/handleListPlans/handleListPlansV2.js"; +import { handleListPlans } from "./handlers/handleListPlans.js"; +import { handleMigrateProductV2 } from "./handlers/handleMigrateProductV2.js"; +import { handleUpdatePlanV1 } from "./handlers/handleUpdatePlan/handleUpdatePlanV1.js"; +import { handleUpdatePlanV2 } from "./handlers/handleUpdatePlan/handleUpdatePlanV2.js"; + +export const honoProductBetaRouter = new Hono(); +honoProductBetaRouter.get("", ...handleListPlans); + +// Create a Hono app for products +export const honoProductRouter = new Hono(); +export const migrationRouter = new Hono(); + +// Migrations +migrationRouter.post("/migrations", ...handleMigrateProductV2); + +// CRUD +honoProductRouter.get("", ...handleListPlans); +honoProductRouter.post("", ...handleCreatePlan); +honoProductRouter.get("/:product_id", ...handleGetPlanV1); +honoProductRouter.post("/:product_id", ...handleUpdatePlanV1); // will be deprecated +honoProductRouter.patch("/:product_id", ...handleUpdatePlanV1); // will be deprecated +honoProductRouter.delete("/:product_id", ...handleDeletePlanV1); + +// Others +honoProductRouter.post("/:product_id/copy", ...handleCopyProductV2); + +// Info before deleting plan +honoProductRouter.get( + "/:product_id/has_customers", + ...handlePlanHasCustomersV2, +); +honoProductRouter.post( + "/:product_id/has_customers", + ...handlePlanHasCustomersV2, +); +honoProductRouter.get("/:product_id/deletion_info", ...handleGetPlanDeleteInfo); + +// RPC +export const plansRpcRouter = new Hono(); +plansRpcRouter.post("/plans.get", ...handleGetPlanV2); +plansRpcRouter.post("/plans.list", ...handleListPlansV2); +plansRpcRouter.post("/plans.create", ...handleCreatePlanV2); +plansRpcRouter.post("/plans.update", ...handleUpdatePlanV2); +plansRpcRouter.post("/plans.delete", ...handleDeletePlanV2); diff --git a/server/src/internal/products/productRouter.ts b/server/src/internal/products/productRouter.ts index fac889218..a1b8a7678 100644 --- a/server/src/internal/products/productRouter.ts +++ b/server/src/internal/products/productRouter.ts @@ -2,14 +2,18 @@ import { Hono } from "hono"; import type { HonoEnv } from "@/honoUtils/HonoEnv.js"; import { handlePlanHasCustomersV2 } from "@/internal/products/handlers/handlePlanHasCustomersV2.js"; import { handleCopyProductV2 } from "./handlers/handleCopyProduct/handleCopyProductV2.js"; -import { handleCreatePlan } from "./handlers/handleCreatePlan.js"; -import { handleDeleteProduct as handleDeleteProductHono } from "./handlers/handleDeleteProduct.js"; -import { handleGetPlan } from "./handlers/handleGetPlan.js"; +import { handleCreatePlan } from "./handlers/handleCreateProduct/handleCreatePlan.js"; +import { handleCreatePlanV2 } from "./handlers/handleCreateProduct/handleCreatePlanV2.js"; +import { handleDeletePlanV1 } from "./handlers/handleDeletePlan/handleDeletePlanV1.js"; +import { handleDeletePlanV2 } from "./handlers/handleDeletePlan/handleDeletePlanV2.js"; +import { handleGetPlanV1 } from "./handlers/handleGetPlan/handleGetPlanV1.js"; +import { handleGetPlanV2 } from "./handlers/handleGetPlan/handleGetPlanV2.js"; import { handleGetPlanDeleteInfo } from "./handlers/handleGetPlanDeleteInfo.js"; import { handleListPlansV2 } from "./handlers/handleListPlans/handleListPlansV2.js"; import { handleListPlans } from "./handlers/handleListPlans.js"; import { handleMigrateProductV2 } from "./handlers/handleMigrateProductV2.js"; -import { handleUpdatePlan } from "./handlers/handleUpdateProduct/handleUpdatePlan.js"; +import { handleUpdatePlanV1 } from "./handlers/handleUpdatePlan/handleUpdatePlanV1.js"; +import { handleUpdatePlanV2 } from "./handlers/handleUpdatePlan/handleUpdatePlanV2.js"; export const honoProductBetaRouter = new Hono(); honoProductBetaRouter.get("", ...handleListPlans); @@ -24,10 +28,10 @@ migrationRouter.post("/migrations", ...handleMigrateProductV2); // CRUD honoProductRouter.get("", ...handleListPlans); honoProductRouter.post("", ...handleCreatePlan); -honoProductRouter.get("/:product_id", ...handleGetPlan); -honoProductRouter.post("/:product_id", ...handleUpdatePlan); // will be deprecated -honoProductRouter.patch("/:product_id", ...handleUpdatePlan); // will be deprecated -honoProductRouter.delete("/:product_id", ...handleDeleteProductHono); +honoProductRouter.get("/:product_id", ...handleGetPlanV1); +honoProductRouter.post("/:product_id", ...handleUpdatePlanV1); // will be deprecated +honoProductRouter.patch("/:product_id", ...handleUpdatePlanV1); // will be deprecated +honoProductRouter.delete("/:product_id", ...handleDeletePlanV1); // Others honoProductRouter.post("/:product_id/copy", ...handleCopyProductV2); @@ -46,3 +50,7 @@ honoProductRouter.get("/:product_id/deletion_info", ...handleGetPlanDeleteInfo); // RPC export const plansRpcRouter = new Hono(); plansRpcRouter.post("/plans.list", ...handleListPlansV2); +plansRpcRouter.post("/plans.create", ...handleCreatePlanV2); +plansRpcRouter.post("/plans.update", ...handleUpdatePlanV2); +plansRpcRouter.post("/plans.delete", ...handleDeletePlanV2); +plansRpcRouter.post("/plans.get", ...handleGetPlanV2); diff --git a/server/src/routers/apiRouter.ts b/server/src/routers/apiRouter.ts index d1123fea6..7ed18016d 100644 --- a/server/src/routers/apiRouter.ts +++ b/server/src/routers/apiRouter.ts @@ -55,6 +55,7 @@ apiRouter.route("", billingRouter); apiRouter.route("", balancesRouter); apiRouter.route("", migrationRouter); apiRouter.route("", entityRouter); +apiRouter.route("", rpcRouter); apiRouter.route("/customers", cusRouter); apiRouter.route("/invoices", invoiceRouter); diff --git a/server/tests/_temp/temp.test.ts b/server/tests/_temp/temp.test.ts index 55db1f454..0cee5fc17 100644 --- a/server/tests/_temp/temp.test.ts +++ b/server/tests/_temp/temp.test.ts @@ -1,32 +1,145 @@ -import { test } from "bun:test"; -import { items } from "@tests/utils/fixtures/items"; -import { products } from "@tests/utils/fixtures/products"; -import { initScenario, s } from "@tests/utils/testInitUtils/initScenario.js"; +import { expect, test } from "bun:test"; +import { ApiVersion, FreeTrialDuration, ResetInterval } from "@autumn/shared"; +import { TestFeature } from "@tests/setup/v2Features"; +import ctx from "@tests/utils/testInitUtils/createTestContext.js"; import chalk from "chalk"; +import { AutumnInt } from "@/external/autumn/autumnCli.js"; +import { ProductService } from "@/internal/products/ProductService.js"; -/** - * Test: Attach free default product, then attach pro with invoice mode - */ -test.concurrent(`${chalk.yellowBright("attach: pro plan with failed payment method")}`, async () => { - const messagesItem = items.monthlyMessages({ includedUsage: 100 }); - const pro = products.pro({ - id: "pro", - items: [messagesItem], - }); +const autumnV2_1 = new AutumnInt({ version: ApiVersion.V2_1 }); +const { db, org, env } = ctx; - const { autumnV1 } = await initScenario({ - customerId: "test-failed-pm", - setup: [ - s.customer({ paymentMethod: "fail" }), // Failed payment method - s.products({ list: [pro] }), +test.concurrent(`${chalk.yellowBright("temp: rest update then rpc inverse update returns product to baseline")}`, async () => { + const productId = `temp_rpc_roundtrip_${Date.now()}`; + const baselineGroup = `baseline_group_${productId}`; + const changedGroup = `changed_group_${productId}`; + + const baseline = { + name: "Temp RPC Baseline", + description: "baseline description", + group: baselineGroup, + add_on: false, + auto_enable: false, + items: [ + { + feature_id: TestFeature.Messages, + included: 100, + reset: { interval: ResetInterval.Month }, + }, ], - actions: [], + free_trial: { + duration_type: FreeTrialDuration.Day, + duration_length: 7, + card_required: false, + }, + }; + + const restUpdates = { + name: "Temp RPC Changed", + group: changedGroup, + add_on: true, + auto_enable: true, + items: [ + { + feature_id: TestFeature.Messages, + included: 250, + reset: { interval: ResetInterval.Month }, + }, + ], + free_trial: { + duration_type: FreeTrialDuration.Day, + duration_length: 14, + card_required: true, + }, + }; + + try { + await autumnV2_1.products.delete(productId); + } catch (_error) {} + + await autumnV2_1.products.create({ + id: productId, + ...baseline, }); - const result = await autumnV1.attach({ - customer_id: "test-failed-pm", - product_id: pro.id, + const initialFull = await ProductService.getFull({ + db, + idOrInternalId: productId, + orgId: org.id, + env, }); - console.log("Attach response:", JSON.stringify(result, null, 2)); + expect(initialFull.name).toBe(baseline.name); + expect(initialFull.description).toBe(baseline.description); + expect(initialFull.group).toBe(baseline.group); + expect(initialFull.is_add_on).toBe(baseline.add_on); + expect(initialFull.is_default).toBe(baseline.auto_enable); + expect( + initialFull.entitlements.find((ent) => ent.feature_id === TestFeature.Messages) + ?.allowance, + ).toBe(100); + + await autumnV2_1.products.update(productId, restUpdates); + + const afterRestUpdate = await ProductService.getFull({ + db, + idOrInternalId: productId, + orgId: org.id, + env, + }); + + expect(afterRestUpdate.name).toBe(restUpdates.name); + expect(afterRestUpdate.group).toBe(restUpdates.group); + expect(afterRestUpdate.is_add_on).toBe(restUpdates.add_on); + expect( + afterRestUpdate.entitlements.find( + (ent) => ent.feature_id === TestFeature.Messages, + )?.allowance, + ).toBe(250); + + const rpcResponse = await autumnV2_1.post("/plans.update", { + plan_id: productId, + ...baseline, + }); + + expect(rpcResponse.id).toBe(productId); + expect(rpcResponse.name).toBe(baseline.name); + expect(rpcResponse.description).toBe(baseline.description); + expect(rpcResponse.group).toBe(baseline.group); + expect(rpcResponse.add_on).toBe(baseline.add_on); + expect(rpcResponse.auto_enable).toBe(baseline.auto_enable); + + const finalFull = await ProductService.getFull({ + db, + idOrInternalId: productId, + orgId: org.id, + env, + }); + + expect(finalFull.version).toBe(initialFull.version); + expect(finalFull.name).toBe(baseline.name); + expect(finalFull.description).toBe(baseline.description); + expect(finalFull.group).toBe(baseline.group); + expect(finalFull.is_add_on).toBe(baseline.add_on); + expect(finalFull.is_default).toBe(baseline.auto_enable); + expect(finalFull.free_trial?.duration).toBe( + baseline.free_trial.duration_type, + ); + expect(finalFull.free_trial?.length).toBe( + baseline.free_trial.duration_length, + ); + expect(finalFull.free_trial?.card_required).toBe( + baseline.free_trial.card_required, + ); + expect( + finalFull.entitlements.find((ent) => ent.feature_id === TestFeature.Messages) + ?.allowance, + ).toBe(100); + + const finalApi = await autumnV2_1.products.get(productId); + expect(finalApi.name).toBe(baseline.name); + expect(finalApi.description).toBe(baseline.description); + expect(finalApi.group).toBe(baseline.group); + expect(finalApi.add_on).toBe(baseline.add_on); + expect(finalApi.auto_enable).toBe(baseline.auto_enable); }); diff --git a/server/tests/integration/crud/plans/rpc-regression/rest-rpc-roundtrip.test.ts b/server/tests/integration/crud/plans/rpc-regression/rest-rpc-roundtrip.test.ts new file mode 100644 index 000000000..7fae648ed --- /dev/null +++ b/server/tests/integration/crud/plans/rpc-regression/rest-rpc-roundtrip.test.ts @@ -0,0 +1,84 @@ +import { expect, test } from "bun:test"; +import { ApiVersion, FreeTrialDuration, ResetInterval } from "@autumn/shared"; +import { TestFeature } from "@tests/setup/v2Features"; +import ctx from "@tests/utils/testInitUtils/createTestContext.js"; +import chalk from "chalk"; +import { AutumnRpcCli } from "@/external/autumn/autumnRpcCli.js"; +import { AutumnInt } from "@/external/autumn/autumnCli.js"; +import { ProductService } from "@/internal/products/ProductService.js"; + +const autumnV2 = new AutumnInt({ version: ApiVersion.V2_0 }); +const autumnRpc = new AutumnRpcCli({ version: ApiVersion.V2_1 }); + +const { db, org, env } = ctx; +const getSuffix = () => Math.random().toString(36).slice(2, 9); + +test.concurrent(`${chalk.yellowBright("rpc regression: rest update then rpc inverse keeps product stable")}`, async () => { + const productId = `rpc_roundtrip_${getSuffix()}`; + const baselineGroup = `rpc_regression_baseline_${productId}`; + const changedGroup = `rpc_regression_changed_${productId}`; + + const baseline = { + name: "RPC Regression Baseline", + group: baselineGroup, + add_on: false, + auto_enable: false, + items: [ + { + feature_id: TestFeature.Messages, + included: 100, + reset: { interval: ResetInterval.Month }, + }, + ], + free_trial: { + duration_type: FreeTrialDuration.Day, + duration_length: 7, + card_required: false, + }, + }; + + const restUpdates = { + name: "RPC Regression Changed", + group: changedGroup, + add_on: true, + items: [ + { + feature_id: TestFeature.Messages, + included: 250, + reset: { interval: ResetInterval.Month }, + }, + ], + free_trial: { + duration_type: FreeTrialDuration.Day, + duration_length: 14, + card_required: true, + }, + }; + + try { + await autumnRpc.plans.delete(productId, { allVersions: true }); + } catch (_error) {} + + await autumnRpc.plans.create({ + id: productId, + ...baseline, + }); + + await autumnV2.products.update(productId, restUpdates); + await autumnRpc.plans.update(productId, baseline); + + const finalFull = await ProductService.getFull({ + db, + idOrInternalId: productId, + orgId: org.id, + env, + }); + + expect(finalFull.name).toBe(baseline.name); + expect(finalFull.group).toBe(baseline.group); + expect(finalFull.is_add_on).toBe(baseline.add_on); + expect( + finalFull.entitlements.find((ent) => ent.feature_id === TestFeature.Messages) + ?.allowance, + ).toBe(100); +}); diff --git a/server/tests/integration/crud/plans/rpc/create-plan-advanced.rpc.test.ts b/server/tests/integration/crud/plans/rpc/create-plan-advanced.rpc.test.ts new file mode 100644 index 000000000..f8337d4fc --- /dev/null +++ b/server/tests/integration/crud/plans/rpc/create-plan-advanced.rpc.test.ts @@ -0,0 +1,129 @@ +import { expect, test } from "bun:test"; +import { + type ApiPlanV1, + type ApiProduct, + ApiVersion, + BillingInterval, + BillingMethod, + type CreatePlanParamsInput, + ProductItemInterval, + ResetInterval, + TierInfinite, + UsageModel, +} from "@autumn/shared"; +import { TestFeature } from "@tests/setup/v2Features"; +import chalk from "chalk"; +import { AutumnInt } from "@/external/autumn/autumnCli.js"; +import { AutumnRpcCli } from "@/external/autumn/autumnRpcCli.js"; + +const autumnRpc = new AutumnRpcCli({ version: ApiVersion.V2_1 }); +const autumnV1_2 = new AutumnInt({ version: ApiVersion.V1_2 }); + +const getSuffix = () => Math.random().toString(36).slice(2, 9); + +test.concurrent(`${chalk.yellowBright("rpc create: metered feature with monthly reset")}`, async () => { + const productId = `rpc_metered_${getSuffix()}`; + const group = `rpc_group_${productId}`; + try { + await autumnRpc.plans.delete(productId, { allVersions: true }); + } catch (_error) {} + + await autumnRpc.plans.create({ + id: productId, + name: "RPC Metered Monthly", + group, + auto_enable: false, + items: [ + { + feature_id: TestFeature.Messages, + included: 1200, + reset: { interval: ResetInterval.Month }, + }, + ], + }); + + const v1_2 = await autumnV1_2.products.get(productId); + const messagesItem = v1_2.items.find( + (item) => item.feature_id === TestFeature.Messages, + ); + expect(messagesItem?.included_usage).toBe(1200); + expect(messagesItem?.interval).toBe(ProductItemInterval.Month); +}); + +test.concurrent(`${chalk.yellowBright("rpc create: tiered usage pricing")}`, async () => { + const productId = `rpc_tiered_${getSuffix()}`; + const group = `rpc_group_${productId}`; + try { + await autumnRpc.plans.delete(productId, { allVersions: true }); + } catch (_error) {} + + await autumnRpc.plans.create({ + id: productId, + name: "RPC Tiered Pricing", + group, + auto_enable: false, + items: [ + { + feature_id: TestFeature.Messages, + price: { + tiers: [ + { to: 100, amount: 0.1 }, + { to: 500, amount: 0.08 }, + { to: TierInfinite, amount: 0.05 }, + ], + interval: BillingInterval.Month, + billing_method: BillingMethod.UsageBased, + billing_units: 1, + }, + }, + ], + }); + + const v1_2 = await autumnV1_2.products.get(productId); + const messagesItem = v1_2.items.find( + (item) => item.feature_id === TestFeature.Messages, + ); + expect(messagesItem?.tiers).toHaveLength(3); + expect(messagesItem?.usage_model).toBe(UsageModel.PayPerUse); +}); + +test.concurrent(`${chalk.yellowBright("rpc create: validation rejects reset/price interval mismatch")}`, async () => { + const productId = `rpc_invalid_${getSuffix()}`; + const group = `rpc_group_${productId}`; + try { + await autumnRpc.plans.delete(productId, { allVersions: true }); + } catch (_error) {} + + let err: { code?: string } | null = null; + try { + await autumnRpc.plans.create({ + id: productId, + name: "RPC Invalid Intervals", + group, + auto_enable: false, + items: [ + { + feature_id: TestFeature.Messages, + included: 100, + reset: { interval: ResetInterval.Minute }, + price: { + amount: 10, + interval: BillingInterval.Month, + billing_method: BillingMethod.UsageBased, + billing_units: 1, + }, + }, + ], + }); + } catch (error: unknown) { + if (error && typeof error === "object" && "code" in error) { + err = error as { code?: string }; + } + } + + expect(err).toBeDefined(); + if (err === null) { + throw new Error("Expected request to fail with invalid_inputs"); + } + expect(err.code).toBe("invalid_inputs"); +}); diff --git a/server/tests/integration/crud/plans/rpc/create-plan-basic.rpc.test.ts b/server/tests/integration/crud/plans/rpc/create-plan-basic.rpc.test.ts new file mode 100644 index 000000000..3c151bc2c --- /dev/null +++ b/server/tests/integration/crud/plans/rpc/create-plan-basic.rpc.test.ts @@ -0,0 +1,96 @@ +import { expect, test } from "bun:test"; +import { + type ApiPlanV1, + ApiPlanV1Schema, + type ApiProduct, + ApiVersion, + BillingInterval, + type CreatePlanParamsInput, +} from "@autumn/shared"; +import { TestFeature } from "@tests/setup/v2Features"; +import chalk from "chalk"; +import { AutumnRpcCli } from "@/external/autumn/autumnRpcCli.js"; +import { AutumnInt } from "@/external/autumn/autumnCli.js"; + +const autumnRpc = new AutumnRpcCli({ version: ApiVersion.V2_1 }); +const autumnV1_2 = new AutumnInt({ version: ApiVersion.V1_2 }); + +const getSuffix = () => Math.random().toString(36).slice(2, 9); + +test.concurrent(`${chalk.yellowBright("rpc create: minimal plan (id + name only)")}`, async () => { + const productId = `rpc_min_plan_${getSuffix()}`; + const group = `rpc_group_${productId}`; + try { + await autumnRpc.plans.delete(productId, { allVersions: true }); + } catch (_error) {} + + const created = await autumnRpc.plans.create({ + id: productId, + name: "RPC Minimal Plan", + group, + auto_enable: false, + }); + + ApiPlanV1Schema.parse(created); + expect(created.id).toBe(productId); + expect(created.items).toHaveLength(0); + + const v1_2 = await autumnV1_2.products.get(productId); + expect(v1_2.items).toHaveLength(0); + expect(v1_2.is_add_on).toBe(false); +}); + +test.concurrent(`${chalk.yellowBright("rpc create: with base price and flags")}`, async () => { + const productId = `rpc_flags_${getSuffix()}`; + const group = `rpc_group_${productId}`; + try { + await autumnRpc.plans.delete(productId, { allVersions: true }); + } catch (_error) {} + + const created = await autumnRpc.plans.create({ + id: productId, + name: "RPC Flags Plan", + group, + add_on: true, + auto_enable: false, + price: { + amount: 4900, + interval: BillingInterval.Month, + }, + }); + + expect(created.add_on).toBe(true); + expect(created.auto_enable).toBe(false); + expect(created.price?.amount).toBe(4900); + expect(created.price?.interval).toBe(BillingInterval.Month); + + const v1_2 = await autumnV1_2.products.get(productId); + expect(v1_2.is_add_on).toBe(true); + expect(v1_2.is_default).toBe(false); +}); + +test.concurrent(`${chalk.yellowBright("rpc create: boolean feature")}`, async () => { + const productId = `rpc_bool_${getSuffix()}`; + const group = `rpc_group_${productId}`; + try { + await autumnRpc.plans.delete(productId, { allVersions: true }); + } catch (_error) {} + + const created = await autumnRpc.plans.create({ + id: productId, + name: "RPC Boolean Plan", + group, + auto_enable: false, + items: [{ feature_id: TestFeature.Dashboard }], + }); + + expect(created.items.length).toBeGreaterThanOrEqual(1); + const booleanItem = created.items.find( + (item: any) => item.feature_id === TestFeature.Dashboard, + ); + expect(booleanItem).toBeDefined(); + + const v1_2 = await autumnV1_2.products.get(productId); + expect(v1_2.items).toHaveLength(1); + expect(v1_2.items[0].feature_id).toBe(TestFeature.Dashboard); +}); diff --git a/server/tests/integration/crud/plans/rpc/delete-plan.rpc.test.ts b/server/tests/integration/crud/plans/rpc/delete-plan.rpc.test.ts new file mode 100644 index 000000000..c00d0e7b5 --- /dev/null +++ b/server/tests/integration/crud/plans/rpc/delete-plan.rpc.test.ts @@ -0,0 +1,44 @@ +import { expect, test } from "bun:test"; +import { ApiVersion, BillingInterval, type CreatePlanParamsInput } from "@autumn/shared"; +import chalk from "chalk"; +import { AutumnRpcCli } from "@/external/autumn/autumnRpcCli.js"; + +const autumnRpc = new AutumnRpcCli({ version: ApiVersion.V2_1 }); +const getSuffix = () => Math.random().toString(36).slice(2, 9); + +test.concurrent(`${chalk.yellowBright("rpc delete: create then delete plan successfully")}`, async () => { + const productId = `rpc_delete_${getSuffix()}`; + const group = `rpc_group_${productId}`; + + try { + await autumnRpc.plans.delete(productId, { allVersions: true }); + } catch (_error) {} + + await autumnRpc.plans.create({ + id: productId, + name: "RPC Delete Test", + group, + auto_enable: false, + price: { + amount: 1900, + interval: BillingInterval.Month, + }, + }); + + const beforeDelete = await autumnRpc.plans.get(productId); + expect(beforeDelete.id).toBe(productId); + + const deleteResult = await autumnRpc.plans.delete(productId, { + allVersions: false, + }); + expect(deleteResult.success).toBe(true); + + let err: any = null; + try { + await autumnRpc.plans.get(productId); + } catch (error) { + err = error; + } + + expect(err).toBeDefined(); +}); diff --git a/server/tests/integration/crud/plans/rpc/get/get-plan-basic.rpc.test.ts b/server/tests/integration/crud/plans/rpc/get/get-plan-basic.rpc.test.ts new file mode 100644 index 000000000..d48e2fc82 --- /dev/null +++ b/server/tests/integration/crud/plans/rpc/get/get-plan-basic.rpc.test.ts @@ -0,0 +1,45 @@ +import { expect, test } from "bun:test"; +import { type ApiPlanV1, ApiPlanV1Schema, ApiVersion } from "@autumn/shared"; +import { TestFeature } from "@tests/setup/v2Features.js"; +import { items } from "@tests/utils/fixtures/items.js"; +import { products } from "@tests/utils/fixtures/products.js"; +import { initScenario, s } from "@tests/utils/testInitUtils/initScenario.js"; +import chalk from "chalk"; +import { AutumnRpcCli } from "@/external/autumn/autumnRpcCli.js"; + +const testCase = "get-plan-basic-rpc"; +const autumnRpc = new AutumnRpcCli({ version: ApiVersion.V2_1 }); + +const messagesItem = items.monthlyMessages({ includedUsage: 100 }); +const wordsItem = items.consumableWords({ includedUsage: 10 }); +const creditsItem = items.monthlyCredits({ includedUsage: 10 }); + +const pro = products.pro({ + id: "pro", + items: [messagesItem, wordsItem, creditsItem], +}); + +test.concurrent(`${chalk.yellowBright("rpc get: get plan response in latest format")}`, async () => { + await initScenario({ + setup: [s.products({ list: [pro], prefix: testCase })], + actions: [], + }); + + const plan = await autumnRpc.plans.get(pro.id); + ApiPlanV1Schema.parse(plan); + + const messagesResponseItem = plan.items.find( + (item: any) => item.feature_id === TestFeature.Messages, + ); + const wordsResponseItem = plan.items.find( + (item: any) => item.feature_id === TestFeature.Words, + ); + const creditsResponseItem = plan.items.find( + (item: any) => item.feature_id === TestFeature.Credits, + ); + + expect(messagesResponseItem).toBeDefined(); + expect(wordsResponseItem).toBeDefined(); + expect(creditsResponseItem).toBeDefined(); + expect(plan.price).toBeDefined(); +}); diff --git a/server/tests/integration/crud/plans/rpc/list/list-plans-cross-version.rpc-regression.test.ts b/server/tests/integration/crud/plans/rpc/list/list-plans-cross-version.rpc-regression.test.ts new file mode 100644 index 000000000..2d0f32947 --- /dev/null +++ b/server/tests/integration/crud/plans/rpc/list/list-plans-cross-version.rpc-regression.test.ts @@ -0,0 +1,59 @@ +import { expect, test } from "bun:test"; +import { + type ApiPlan, + ApiPlanV0Schema, + type ApiPlanV1, + ApiPlanV1Schema, + type ApiProduct, + ApiProductSchema, + ApiVersion, + type CreatePlanParamsInput, +} from "@autumn/shared"; +import { TestFeature } from "@tests/setup/v2Features.js"; +import chalk from "chalk"; +import { AutumnInt } from "@/external/autumn/autumnCli.js"; +import { AutumnRpcCli } from "@/external/autumn/autumnRpcCli.js"; + +const autumnRpc = new AutumnRpcCli({ version: ApiVersion.V2_1 }); +const autumnV1 = new AutumnInt({ version: ApiVersion.V1_2 }); +const autumnV2_0 = new AutumnInt({ version: ApiVersion.V2_0 }); +const autumnV2_1 = new AutumnInt({ version: ApiVersion.V2_1 }); + +const getSuffix = () => Math.random().toString(36).slice(2, 9); + +test.concurrent(`${chalk.yellowBright("rpc regression: rest list stays cross-version compatible after rpc create")}`, async () => { + const suffix = getSuffix(); + const freeId = `rpc_list_free_${suffix}`; + const freeGroup = `rpc_list_group_free_${suffix}`; + + try { + await autumnRpc.plans.delete(freeId, { allVersions: true }); + } catch (_error) { + // no-op + } + + await autumnRpc.plans.create({ + id: freeId, + name: "RPC List Free", + group: freeGroup, + items: [{ feature_id: TestFeature.Credits, included: 500 }], + }); + + const plansV2_1 = await autumnV2_1.products.list(); + const plansV2_0 = await autumnV2_0.products.list(); + const productsV1 = await autumnV1.products.list(); + + for (const plan of plansV2_1.list) { + ApiPlanV1Schema.parse(plan); + } + for (const plan of plansV2_0.list) { + ApiPlanV0Schema.parse(plan); + } + for (const product of productsV1.list) { + ApiProductSchema.parse(product); + } + + expect(plansV2_1.list.some((plan) => plan.id === freeId)).toBe(true); + expect(plansV2_0.list.some((plan) => plan.id === freeId)).toBe(true); + expect(productsV1.list.some((product) => product.id === freeId)).toBe(true); +}); diff --git a/server/tests/integration/crud/plans/rpc/update-plan-price-items.test.ts b/server/tests/integration/crud/plans/rpc/update-plan-price-items.test.ts new file mode 100644 index 000000000..43cc87d2d --- /dev/null +++ b/server/tests/integration/crud/plans/rpc/update-plan-price-items.test.ts @@ -0,0 +1,242 @@ +import { expect, test } from "bun:test"; +import { + type ApiPlanV1, + ApiVersion, + BillingInterval, + ResetInterval, + type UpdatePlanParamsV2Input, +} from "@autumn/shared"; +import { TestFeature } from "@tests/setup/v2Features"; +import ctx from "@tests/utils/testInitUtils/createTestContext.js"; +import chalk from "chalk"; +import { AutumnRpcCli } from "@/external/autumn/autumnRpcCli.js"; +import { ProductService } from "@/internal/products/ProductService.js"; + +const autumnRpc = new AutumnRpcCli({ version: ApiVersion.V2_1 }); + +const { db, org, env } = ctx; +type UpdatePlanRpcInput = Omit; + +const getPriceAmount = ({ + full, +}: { + full: Awaited>; +}) => { + const firstPrice = full.prices[0]; + if (!firstPrice) return undefined; + const { config } = firstPrice; + if (!("amount" in config)) return undefined; + return config.amount; +}; + +const getPriceInterval = ({ + full, +}: { + full: Awaited>; +}) => { + const firstPrice = full.prices[0]; + if (!firstPrice) return undefined; + return firstPrice.config.interval; +}; + +const createTestPlan = async (planId: string) => { + try { + await autumnRpc.plans.delete(planId, { allVersions: true }); + } catch (_error) {} + + return await autumnRpc.plans.create({ + plan_id: planId, + name: `Test Plan ${planId}`, + group: `group_${planId}`, + price: { + amount: 1000, + interval: BillingInterval.Month, + }, + items: [ + { + feature_id: TestFeature.Messages, + included: 100, + reset: { interval: ResetInterval.Month }, + }, + ], + }); +}; + +test.concurrent(`${chalk.yellowBright("rpc update: price and items undefined -> product items remain unchanged")}`, async () => { + const planId = "rpc_update_unchanged"; + await createTestPlan(planId); + + const initialFull = await ProductService.getFull({ + db, + idOrInternalId: planId, + orgId: org.id, + env, + }); + + const initialPriceCount = initialFull.prices.length; + const initialEntitlementCount = initialFull.entitlements.length; + const initialPriceAmount = getPriceAmount({ full: initialFull }); + const initialAllowance = initialFull.entitlements.find( + (e) => e.feature_id === TestFeature.Messages, + )?.allowance; + + await autumnRpc.plans.update(planId, { + name: "Updated Name Only", + }); + + const updatedFull = await ProductService.getFull({ + db, + idOrInternalId: planId, + orgId: org.id, + env, + }); + + expect(updatedFull.prices.length).toBe(initialPriceCount); + expect(updatedFull.entitlements.length).toBe(initialEntitlementCount); + expect(getPriceAmount({ full: updatedFull })).toBe(initialPriceAmount); + expect( + updatedFull.entitlements.find((e) => e.feature_id === TestFeature.Messages) + ?.allowance, + ).toBe(initialAllowance); +}); + +test.concurrent(`${chalk.yellowBright("rpc update: price undefined, items defined -> base price unchanged, items change")}`, async () => { + const planId = "rpc_update_items_only"; + await createTestPlan(planId); + + const initialFull = await ProductService.getFull({ + db, + idOrInternalId: planId, + orgId: org.id, + env, + }); + + const initialPriceAmount = getPriceAmount({ full: initialFull }); + + await autumnRpc.plans.update(planId, { + items: [ + { + feature_id: TestFeature.Messages, + included: 500, + reset: { interval: ResetInterval.Month }, + }, + ], + }); + + const updatedFull = await ProductService.getFull({ + db, + idOrInternalId: planId, + orgId: org.id, + env, + }); + + expect(getPriceAmount({ full: updatedFull })).toBe(initialPriceAmount); + expect( + updatedFull.entitlements.find((e) => e.feature_id === TestFeature.Messages) + ?.allowance, + ).toBe(500); +}); + +test.concurrent(`${chalk.yellowBright("rpc update: price defined, items undefined -> base price changes, items unchanged")}`, async () => { + const planId = "rpc_update_price_only"; + await createTestPlan(planId); + + const initialFull = await ProductService.getFull({ + db, + idOrInternalId: planId, + orgId: org.id, + env, + }); + + const initialAllowance = initialFull.entitlements.find( + (e) => e.feature_id === TestFeature.Messages, + )?.allowance; + + await autumnRpc.plans.update(planId, { + price: { + amount: 2500, + interval: BillingInterval.Month, + }, + }); + + const updatedFull = await ProductService.getFull({ + db, + idOrInternalId: planId, + orgId: org.id, + env, + }); + + expect(getPriceAmount({ full: updatedFull })).toBe(2500); + expect( + updatedFull.entitlements.find((e) => e.feature_id === TestFeature.Messages) + ?.allowance, + ).toBe(initialAllowance); +}); + +test.concurrent(`${chalk.yellowBright("rpc update: price null, items undefined -> base price removed, items unchanged")}`, async () => { + const planId = "rpc_update_price_null"; + await createTestPlan(planId); + + const initialFull = await ProductService.getFull({ + db, + idOrInternalId: planId, + orgId: org.id, + env, + }); + + expect(initialFull.prices.length).toBeGreaterThan(0); + + const initialAllowance = initialFull.entitlements.find( + (e) => e.feature_id === TestFeature.Messages, + )?.allowance; + + await autumnRpc.plans.update(planId, { + price: null, + }); + + const updatedFull = await ProductService.getFull({ + db, + idOrInternalId: planId, + orgId: org.id, + env, + }); + + expect(updatedFull.prices.length).toBe(0); + expect( + updatedFull.entitlements.find((e) => e.feature_id === TestFeature.Messages) + ?.allowance, + ).toBe(initialAllowance); +}); + +test.concurrent(`${chalk.yellowBright("rpc update: price defined, items defined -> base price and items changed")}`, async () => { + const planId = "rpc_update_price_and_items"; + await createTestPlan(planId); + + await autumnRpc.plans.update(planId, { + price: { + amount: 5000, + interval: BillingInterval.Year, + }, + items: [ + { + feature_id: TestFeature.Messages, + included: 1000, + reset: { interval: ResetInterval.Year }, + }, + ], + }); + + const updatedFull = await ProductService.getFull({ + db, + idOrInternalId: planId, + orgId: org.id, + env, + }); + + expect(getPriceAmount({ full: updatedFull })).toBe(5000); + expect(getPriceInterval({ full: updatedFull })).toBe(BillingInterval.Year); + expect( + updatedFull.entitlements.find((e) => e.feature_id === TestFeature.Messages) + ?.allowance, + ).toBe(1000); +}); diff --git a/server/tests/integration/crud/plans/rpc/update-plan.rpc.test.ts b/server/tests/integration/crud/plans/rpc/update-plan.rpc.test.ts new file mode 100644 index 000000000..a21f17be5 --- /dev/null +++ b/server/tests/integration/crud/plans/rpc/update-plan.rpc.test.ts @@ -0,0 +1,223 @@ +import { expect, test } from "bun:test"; +import { + type ApiPlanV1, + type ApiProduct, + ApiVersion, + type CreateProductV2ParamsInput, + ProductItemInterval, + ResetInterval, + type UpdatePlanParamsInput, +} from "@autumn/shared"; +import { TestFeature } from "@tests/setup/v2Features"; +import ctx from "@tests/utils/testInitUtils/createTestContext.js"; +import chalk from "chalk"; +import { AutumnInt } from "@/external/autumn/autumnCli.js"; +import { AutumnRpcCli } from "@/external/autumn/autumnRpcCli.js"; +import { ProductService } from "@/internal/products/ProductService.js"; + +const autumnRpc = new AutumnRpcCli({ version: ApiVersion.V2_1 }); +const autumnV1_2 = new AutumnInt({ version: ApiVersion.V1_2 }); + +const { db, org, env } = ctx; + +test.concurrent(`${chalk.yellowBright("rpc update: match existing entitlement by feature_id (no entitlement_id)")}`, async () => { + const productId = "rpc_update_match_1"; + const group = `rpc_group_${productId}`; + try { + await autumnRpc.plans.delete(productId, { allVersions: true }); + } catch (_error) {} + + await autumnV1_2.products.create({ + id: productId, + name: "RPC Update Match Test", + group, + is_default: false, + items: [ + { + feature_id: TestFeature.Messages, + included_usage: 1000, + interval: ProductItemInterval.Month, + }, + ], + }); + + const initialFull = await ProductService.getFull({ + db, + idOrInternalId: productId, + orgId: org.id, + env, + }); + expect( + initialFull.entitlements.find((e) => e.feature_id === TestFeature.Messages) + ?.id, + ).toBeDefined(); + + await autumnRpc.plans.update(productId, { + items: [ + { + feature_id: TestFeature.Messages, + included: 2000, + reset: { interval: ResetInterval.Month }, + }, + ], + }); + + const updatedFull = await ProductService.getFull({ + db, + idOrInternalId: productId, + orgId: org.id, + env, + }); + + expect( + updatedFull.entitlements.find((e) => e.feature_id === TestFeature.Messages) + ?.allowance, + ).toBe(2000); +}); + +test.concurrent(`${chalk.yellowBright("rpc update: match entitlement with same feature + interval")}`, async () => { + const productId = "rpc_update_match_2"; + const group = `rpc_group_${productId}`; + try { + await autumnRpc.plans.delete(productId, { allVersions: true }); + } catch (_error) {} + + await autumnV1_2.products.create({ + id: productId, + name: "RPC Quarterly Match Test", + group, + is_default: false, + items: [ + { + feature_id: TestFeature.Messages, + included_usage: 500, + interval: ProductItemInterval.Quarter, + }, + ], + }); + + await autumnRpc.plans.update(productId, { + items: [ + { + feature_id: TestFeature.Messages, + included: 1500, + reset: { interval: ResetInterval.Quarter }, + }, + ], + }); + + const updatedFull = await ProductService.getFull({ + db, + idOrInternalId: productId, + orgId: org.id, + env, + }); + + expect( + updatedFull.entitlements.find((e) => e.feature_id === TestFeature.Messages) + ?.allowance, + ).toBe(1500); +}); + +test.concurrent(`${chalk.yellowBright("rpc update: create NEW entitlement when interval changes")}`, async () => { + const productId = "rpc_update_interval_change"; + const group = `rpc_group_${productId}`; + try { + await autumnRpc.plans.delete(productId, { allVersions: true }); + } catch (_error) {} + + await autumnV1_2.products.create({ + id: productId, + name: "RPC Interval Change Test", + group, + is_default: false, + items: [ + { + feature_id: TestFeature.Messages, + included_usage: 1000, + interval: ProductItemInterval.Month, + }, + ], + }); + + await autumnRpc.plans.update(productId, { + items: [ + { + feature_id: TestFeature.Messages, + included: 3000, + reset: { interval: ResetInterval.Quarter }, + }, + ], + }); + + const updatedFull = await ProductService.getFull({ + db, + idOrInternalId: productId, + orgId: org.id, + env, + }); + + expect( + updatedFull.entitlements.find((e) => e.feature_id === TestFeature.Messages) + ?.allowance, + ).toBe(3000); +}); + +test.concurrent(`${chalk.yellowBright("rpc update: handle multiple features with same feature_id (different intervals)")}`, async () => { + const productId = "rpc_multi_interval"; + const group = `rpc_group_${productId}`; + try { + await autumnRpc.plans.delete(productId, { allVersions: true }); + } catch (_error) {} + + await autumnV1_2.products.create({ + id: productId, + name: "RPC Multi Interval Test", + group, + is_default: false, + items: [ + { + feature_id: TestFeature.Messages, + included_usage: 1000, + interval: ProductItemInterval.Month, + }, + { + feature_id: TestFeature.Messages, + included_usage: 3000, + interval: ProductItemInterval.Quarter, + }, + ], + }); + + await autumnRpc.plans.update(productId, { + items: [ + { + feature_id: TestFeature.Messages, + included: 1500, + reset: { interval: ResetInterval.Month }, + }, + { + feature_id: TestFeature.Messages, + included: 4500, + reset: { interval: ResetInterval.Quarter }, + }, + ], + }); + + const updatedFull = await ProductService.getFull({ + db, + idOrInternalId: productId, + orgId: org.id, + env, + }); + + const monthlyEnt = updatedFull.entitlements.find( + (e) => e.feature_id === TestFeature.Messages && e.interval === "month", + ); + const quarterlyEnt = updatedFull.entitlements.find( + (e) => e.feature_id === TestFeature.Messages && e.interval === "quarter", + ); + + expect(monthlyEnt?.allowance).toBe(1500); + expect(quarterlyEnt?.allowance).toBe(4500); +}); diff --git a/shared/api/common/freeTrial/freeTrialParamsV1.ts b/shared/api/common/freeTrial/freeTrialParamsV1.ts index 60022a4c5..4eab96293 100644 --- a/shared/api/common/freeTrial/freeTrialParamsV1.ts +++ b/shared/api/common/freeTrial/freeTrialParamsV1.ts @@ -2,9 +2,19 @@ import { FreeTrialDuration } from "@models/productModels/freeTrialModels/freeTri import { z } from "zod/v4"; export const FreeTrialParamsV1Schema = z.object({ - duration_length: z.number(), - duration_type: z.enum(FreeTrialDuration).default(FreeTrialDuration.Month), - card_required: z.boolean().default(true), + duration_length: z.number().meta({ + description: "Number of duration_type periods the trial lasts.", + }), + duration_type: z + .enum(FreeTrialDuration) + .default(FreeTrialDuration.Month) + .meta({ + description: "Unit of time for the trial ('day', 'month', 'year').", + }), + card_required: z.boolean().default(true).meta({ + description: + "If true, payment method required to start trial. Customer is charged after trial ends.", + }), }); export type FreeTrialParamsV1 = z.infer; diff --git a/shared/api/products/apiPlanV1.ts b/shared/api/products/apiPlanV1.ts index 8ac67da7b..26b45ecd0 100644 --- a/shared/api/products/apiPlanV1.ts +++ b/shared/api/products/apiPlanV1.ts @@ -4,42 +4,129 @@ import { BillingInterval } from "@models/productModels/intervals/billingInterval import { z } from "zod/v4"; import { ApiFreeTrialV2Schema } from "./components/apiFreeTrialV2.js"; import { DisplaySchema } from "./components/display.js"; -import { ApiPlanItemV1Schema } from "./items/apiPlanItemV1.js"; +import { + API_PLAN_ITEM_PREPAID_EXAMPLE, + API_PLAN_ITEM_USAGE_BASED_EXAMPLE, + ApiPlanItemV1Schema, +} from "./items/apiPlanItemV1.js"; + +export const API_PLAN_V1_EXAMPLE = { + id: "pro", + name: "Pro Plan", + description: null, + group: null, + version: 1, + addOn: false, + autoEnable: false, + price: { + amount: 10, + interval: "month", + display: { + primaryText: "$10", + secondaryText: "per month", + }, + }, + items: [API_PLAN_ITEM_USAGE_BASED_EXAMPLE, API_PLAN_ITEM_PREPAID_EXAMPLE], + createdAt: 1771513979217, + env: "sandbox", + archived: false, + baseVariantId: null, +}; export const ApiPlanV1Schema = z.object({ - id: z.string(), - name: z.string(), - description: z.string().nullable(), - group: z.string().nullable(), + id: z.string().meta({ + description: "Unique identifier for the plan.", + }), + name: z.string().meta({ + description: "Display name of the plan.", + }), + description: z.string().nullable().meta({ + description: "Optional description of the plan.", + }), + group: z.string().nullable().meta({ + description: + "Group identifier for organizing related plans. Plans in the same group are mutually exclusive.", + }), - version: z.number(), - add_on: z.boolean(), - auto_enable: z.boolean(), + version: z.number().meta({ + description: + "Version number of the plan. Incremented when plan configuration changes.", + }), + add_on: z.boolean().meta({ + description: + "Whether this is an add-on plan that can be attached alongside a main plan.", + }), + auto_enable: z.boolean().meta({ + description: + "If true, this plan is automatically attached when a customer is created. Used for free plans.", + }), price: z .object({ - amount: z.number(), - interval: z.enum(BillingInterval), - interval_count: z.number().optional(), - display: DisplaySchema.optional(), + amount: z.number().meta({ + description: "Base price amount for the plan.", + }), + interval: z.enum(BillingInterval).meta({ + description: "Billing interval (e.g. 'month', 'year').", + }), + interval_count: z.number().optional().meta({ + description: "Number of intervals per billing cycle. Defaults to 1.", + }), + display: DisplaySchema.optional().meta({ + description: "Display text for showing this price in pricing pages.", + }), }) - .nullable(), + .nullable() + .meta({ + description: + "Base recurring price for the plan. Null for free plans or usage-only plans.", + }), - items: z.array(ApiPlanItemV1Schema), - free_trial: ApiFreeTrialV2Schema.optional(), + items: z.array(ApiPlanItemV1Schema).meta({ + description: + "Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.", + }), + free_trial: ApiFreeTrialV2Schema.optional().meta({ + description: + "Free trial configuration. If set, new customers can try this plan before being charged.", + }), - // Misc - created_at: z.number(), - env: z.enum(AppEnv), - archived: z.boolean(), - base_variant_id: z.string().nullable(), + created_at: z.number().meta({ + description: "Unix timestamp (ms) when the plan was created.", + }), + env: z.enum(AppEnv).meta({ + description: "Environment this plan belongs to ('sandbox' or 'live').", + }), + archived: z.boolean().meta({ + description: + "Whether the plan is archived. Archived plans cannot be attached to new customers.", + }), + base_variant_id: z.string().nullable().meta({ + description: + "If this is a variant, the ID of the base plan it was created from.", + }), customer_eligibility: z .object({ - trial_available: z.boolean().optional(), - scenario: z.enum(AttachScenario), + trial_available: z.boolean().optional().meta({ + description: "Whether a free trial is available for this customer.", + }), + scenario: z.enum(AttachScenario).meta({ + description: + "The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).", + }), }) - .optional(), + .optional() + .meta({ + internal: true, + }), }); export type ApiPlanV1 = z.infer; + +export const ApiPlanV1WithMeta = ApiPlanV1Schema.meta({ + id: "Plan", + description: + "A plan defines a set of features, pricing, and entitlements that can be attached to customers.", + example: API_PLAN_V1_EXAMPLE, +}); diff --git a/shared/api/products/components/apiFreeTrialV2.ts b/shared/api/products/components/apiFreeTrialV2.ts index 6d6c7f9c1..95af0ffd2 100644 --- a/shared/api/products/components/apiFreeTrialV2.ts +++ b/shared/api/products/components/apiFreeTrialV2.ts @@ -2,9 +2,17 @@ import { FreeTrialDuration } from "@models/productModels/freeTrialModels/freeTri import { z } from "zod/v4"; export const ApiFreeTrialV2Schema = z.object({ - duration_length: z.number(), - duration_type: z.enum(FreeTrialDuration), - card_required: z.boolean(), + duration_length: z.number().meta({ + description: "Number of duration_type periods the trial lasts.", + }), + duration_type: z.enum(FreeTrialDuration).meta({ + description: + "Unit of time for the trial duration ('day', 'month', 'year').", + }), + card_required: z.boolean().meta({ + description: + "Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.", + }), }); export type ApiFreeTrialV2 = z.infer; diff --git a/shared/api/products/components/basePrice/basePrice.ts b/shared/api/products/components/basePrice/basePrice.ts index 1078593fa..1ab6ef4a3 100644 --- a/shared/api/products/components/basePrice/basePrice.ts +++ b/shared/api/products/components/basePrice/basePrice.ts @@ -3,16 +3,26 @@ import { z } from "zod/v4"; import { DisplaySchema } from "../display"; export const BasePriceSchema = z.object({ - amount: z.number(), - interval: z.enum(BillingInterval), - interval_count: z.number().optional(), - display: DisplaySchema.optional(), + amount: z.number().meta({ + description: "Base price amount for the plan.", + }), + interval: z.enum(BillingInterval).meta({ + description: "Billing interval (e.g. 'month', 'year').", + }), + interval_count: z.number().optional().meta({ + description: "Number of intervals per billing cycle. Defaults to 1.", + }), + display: DisplaySchema.optional().meta({ + description: "Display text for showing this price in pricing pages.", + }), }); export const BasePriceParamsSchema = BasePriceSchema.omit({ display: true, }).extend({ - interval_count: z.number().optional(), + interval_count: z.number().optional().meta({ + description: "Number of intervals per billing cycle. Defaults to 1.", + }), entitlement_id: z.string().optional().meta({ internal: true, diff --git a/shared/api/products/components/display.ts b/shared/api/products/components/display.ts index f05ccee4e..0979a21a1 100644 --- a/shared/api/products/components/display.ts +++ b/shared/api/products/components/display.ts @@ -1,6 +1,11 @@ import { z } from "zod/v4"; export const DisplaySchema = z.object({ - primary_text: z.string(), - secondary_text: z.string().optional(), + primary_text: z.string().meta({ + description: "Main display text (e.g. '$10' or '100 messages').", + }), + secondary_text: z.string().optional().meta({ + description: + "Secondary display text (e.g. 'per month' or 'then $0.5 per 100').", + }), }); diff --git a/shared/api/products/crud/createPlanParamsV0.ts b/shared/api/products/crud/createPlanParamsV0.ts deleted file mode 100644 index 67403b06b..000000000 --- a/shared/api/products/crud/createPlanParamsV0.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { FreeTrialParamsV1Schema } from "@api/common/freeTrial/freeTrialParamsV1.js"; -import { BasePriceParamsSchema } from "@api/products/components/basePrice/basePrice.js"; -import { idRegex } from "@utils/utils.js"; -import { z } from "zod/v4"; -import { CreatePlanItemParamsV1Schema } from "../items/crud/createPlanItemParamsV1.js"; - -export const CreatePlanParamsV1Schema = z.object({ - id: z.string().nonempty().regex(idRegex), - group: z.string().default(""), - - name: z.string().nonempty(), - description: z.string().nullable().default(null), - - add_on: z.boolean().default(false), - auto_enable: z.boolean().default(false), - - price: BasePriceParamsSchema.optional(), - - items: z.array(CreatePlanItemParamsV1Schema).optional(), - free_trial: FreeTrialParamsV1Schema.optional(), -}); - -export type CreatePlanParams = z.infer; -export type CreatePlanParamsInput = z.input; diff --git a/shared/api/products/crud/createPlanParamsV1.ts b/shared/api/products/crud/createPlanParamsV1.ts new file mode 100644 index 000000000..2019850c1 --- /dev/null +++ b/shared/api/products/crud/createPlanParamsV1.ts @@ -0,0 +1,62 @@ +import { FreeTrialParamsV1Schema } from "@api/common/freeTrial/freeTrialParamsV1.js"; +import { BasePriceParamsSchema } from "@api/products/components/basePrice/basePrice.js"; +import { idRegex } from "@utils/utils.js"; +import { z } from "zod/v4"; +import { CreatePlanItemParamsV1Schema } from "../items/crud/createPlanItemParamsV1.js"; + +export const CreatePlanParamsV1Schema = z.object({ + id: z.string().nonempty().regex(idRegex).meta({ + description: "Unique identifier for the plan.", + }), + group: z.string().default("").meta({ + description: + "Group identifier for organizing related plans. Plans in the same group are mutually exclusive.", + }), + + name: z.string().nonempty().meta({ + description: "Display name of the plan.", + }), + description: z.string().nullable().default(null).meta({ + description: "Optional description of the plan.", + }), + + add_on: z.boolean().default(false).meta({ + description: + "If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group.", + }), + auto_enable: z.boolean().default(false).meta({ + description: + "If true, plan is automatically attached when a customer is created. Use for free tiers.", + }), + + price: BasePriceParamsSchema.optional().meta({ + description: + "Base recurring price for the plan. Omit for free or usage-only plans.", + }), + + items: z.array(CreatePlanItemParamsV1Schema).optional().meta({ + description: + "Feature configurations for this plan. Each item defines included units, pricing, and reset behavior.", + }), + free_trial: FreeTrialParamsV1Schema.optional().meta({ + description: + "Free trial configuration. Customers can try this plan before being charged.", + }), +}); + +export const CreatePlanParamsV2Schema = z + .object({ + plan_id: z + .string() + .nonempty() + .regex(idRegex) + .meta({ + description: "The ID of the plan to create.", + }), + }) + .extend(CreatePlanParamsV1Schema.omit({ id: true }).shape); + +export type CreatePlanParams = z.infer; +export type CreatePlanParamsInput = z.input; +export type CreatePlanParamsV2 = z.infer; +export type CreatePlanParamsV2Input = z.input; diff --git a/shared/api/products/crud/deletePlanParamsV2.ts b/shared/api/products/crud/deletePlanParamsV2.ts new file mode 100644 index 000000000..4fee64507 --- /dev/null +++ b/shared/api/products/crud/deletePlanParamsV2.ts @@ -0,0 +1,14 @@ +import { z } from "zod/v4"; + +export const DeletePlanParamsV2Schema = z.object({ + plan_id: z.string().nonempty().meta({ + description: "The ID of the plan to delete.", + }), + all_versions: z.boolean().default(false).optional().meta({ + description: + "If true, deletes all versions of the plan. Otherwise, only deletes the latest version.", + }), +}); + +export type DeletePlanParamsV2 = z.infer; +export type DeletePlanParamsV2Input = z.input; diff --git a/shared/api/products/crud/getPlanParamsV0.ts b/shared/api/products/crud/getPlanParamsV0.ts new file mode 100644 index 000000000..db28723e4 --- /dev/null +++ b/shared/api/products/crud/getPlanParamsV0.ts @@ -0,0 +1,14 @@ +import { z } from "zod/v4"; + +export const GetPlanParamsV0Schema = z.object({ + plan_id: z.string().nonempty().meta({ + description: "The ID of the plan to retrieve.", + }), + version: z.number().optional().meta({ + description: + "The version of the plan to get. Defaults to the latest version.", + }), +}); + +export type GetPlanParamsV0 = z.infer; +export type GetPlanParamsV0Input = z.input; diff --git a/shared/api/products/crud/index.ts b/shared/api/products/crud/index.ts index cc4d3e01c..fe0e8858d 100644 --- a/shared/api/products/crud/index.ts +++ b/shared/api/products/crud/index.ts @@ -1,3 +1,5 @@ -export * from "./createPlanParamsV0"; -export * from "./listPlanParams"; -export * from "./updatePlanParamsV0"; +export * from "./createPlanParamsV1.js"; +export * from "./deletePlanParamsV2.js"; +export * from "./getPlanParamsV0.js"; +export * from "./listPlanParams.js"; +export * from "./updatePlanParamsV1.js"; diff --git a/shared/api/products/crud/listPlanParams.ts b/shared/api/products/crud/listPlanParams.ts index f6455d414..2944a07a3 100644 --- a/shared/api/products/crud/listPlanParams.ts +++ b/shared/api/products/crud/listPlanParams.ts @@ -2,18 +2,38 @@ import { z } from "zod/v4"; export const ListPlanParamsSchema = z .object({ - customer_id: z.string().optional(), - entity_id: z.string().optional(), - include_archived: z.boolean().optional(), + customer_id: z + .string() + .optional() + .meta({ + description: + "Customer ID to include eligibility info (trial availability, attach scenario).", + }), + entity_id: z + .string() + .optional() + .meta({ description: "Entity ID for entity-scoped plans." }), + include_archived: z + .boolean() + .optional() + .meta({ description: "If true, includes archived plans in the response." }), }) .optional(); export const ListPlansQuerySchema = z.object({ - customer_id: z.string().optional(), + customer_id: z + .string() + .optional() + .meta({ + description: + "Customer ID to include eligibility info (trial availability, attach scenario).", + }), entity_id: z.string().optional().meta({ + description: "Entity ID for entity-scoped plans.", internal: true, }), include_archived: z.boolean().optional().meta({ + description: "If true, includes archived plans in the response.", internal: true, }), v1_schema: z.boolean().optional().meta({ diff --git a/shared/api/products/crud/mappers/planParamsV1ToProductItems.ts b/shared/api/products/crud/mappers/planParamsV1ToProductItems.ts new file mode 100644 index 000000000..6a4d86a6a --- /dev/null +++ b/shared/api/products/crud/mappers/planParamsV1ToProductItems.ts @@ -0,0 +1,69 @@ +import type { BasePriceParams } from "@api/products/components/basePrice/basePrice"; +import { basePriceToProductItem } from "@api/products/components/basePrice/basePriceToProductItem"; +import type { CreatePlanItemParamsV1 } from "@api/products/items/crud/createPlanItemParamsV1"; +import { planV1ToProductItems } from "@api/products/mappers/planV1ToProductItems"; +import type { FullProduct } from "@models/productModels/productModels"; +import type { ProductItem } from "@models/productV2Models/productItemModels/productItemModels"; +import { isPriceItem, mapToProductItems } from "@utils/index"; +import type { SharedContext } from "../../../../types/sharedContext"; + +export function planParamsV1ToProductItems({ + ctx, + params, + currentFullProduct, +}: { + ctx: SharedContext; + // params: CreatePlanParams | UpdatePlanParams; + params: { + price?: BasePriceParams | null; + items?: CreatePlanItemParamsV1[]; + }; + currentFullProduct?: FullProduct; +}): ProductItem[] | undefined { + const currentProductItems = mapToProductItems({ + prices: currentFullProduct?.prices ?? [], + entitlements: currentFullProduct?.entitlements ?? [], + features: ctx.features, + }); + + if (params.price === undefined && params.items === undefined) { + console.log("price and items undefined!"); + return undefined; + } + + if (params.price !== undefined && params.items !== undefined) { + console.log("price and items provided!"); + // 1. If price AND items provided, return full items array + return planV1ToProductItems({ + ctx, + plan: { price: params.price, items: params.items }, + }); + } + + if (params.price !== undefined && params.items === undefined) { + console.log("items undefined!"); + // 2. If price provided, but no items, then customize base price and carry over feature items + const featureItems = currentProductItems.filter( + (item) => !isPriceItem(item), + ); + + const basePriceItem = params.price + ? basePriceToProductItem({ + ctx, + basePrice: params.price, + }) + : undefined; + + return basePriceItem ? [basePriceItem, ...featureItems] : featureItems; + } + console.log("price and items undefined!"); + + // 3. If no price provided, then carry over base price + const basePriceItem = currentProductItems.filter((item) => isPriceItem(item)); + const featureItems = planV1ToProductItems({ + ctx, + plan: { price: null, items: params.items ?? [] }, + }); + + return [...basePriceItem, ...featureItems]; +} diff --git a/shared/api/products/crud/mappers/planParamsV1ToProductV2.ts b/shared/api/products/crud/mappers/planParamsV1ToProductV2.ts index 8ddbba028..c1f459936 100644 --- a/shared/api/products/crud/mappers/planParamsV1ToProductV2.ts +++ b/shared/api/products/crud/mappers/planParamsV1ToProductV2.ts @@ -1,17 +1,20 @@ -import type { CreatePlanParams } from "@api/products/crud/createPlanParamsV0"; -import type { UpdatePlanParams } from "@api/products/crud/updatePlanParamsV0"; -import { planItemParamsV1ToPlanItemV0 } from "@api/products/items/mappers/planItemParamsV1ToPlanItemV0"; -import { planV0ToProductItems } from "@api/products/mappers/planV0ToProductItems"; +import type { CreatePlanParams } from "@api/products/crud/createPlanParamsV1"; +import type { UpdatePlanParams } from "@api/products/crud/updatePlanParamsV1"; import type { AppEnv } from "@models/genModels/genEnums"; +import type { FullProduct } from "@models/productModels/productModels"; import type { ProductV2 } from "@models/productV2Models/productV2Models"; +import { notNullish } from "@utils/index"; import type { SharedContext } from "../../../../types/sharedContext"; +import { planParamsV1ToProductItems } from "./planParamsV1ToProductItems"; export function planParamsV1ToProductV2({ ctx, params, + currentFullProduct, }: { ctx: SharedContext; params: CreatePlanParams | UpdatePlanParams; + currentFullProduct?: FullProduct; // Here to enforce type checking, probably not used but just to be sure. overrides?: { @@ -20,16 +23,14 @@ export function planParamsV1ToProductV2({ created_at: number; }; }): Partial { - const planFeatures = - params.items?.map((item) => planItemParamsV1ToPlanItemV0({ ctx, item })) ?? - []; - - const price = params.price; - // Convert plan to items using shared utility - const items = planV0ToProductItems({ + const items = planParamsV1ToProductItems({ ctx, - plan: { features: planFeatures, price: price ?? null }, + params: { + price: params.price, + items: params.items, + }, + currentFullProduct, }); // Check if archived field exists on plan (it's on ApiPlan, not CreatePlanParams) @@ -47,15 +48,14 @@ export function planParamsV1ToProductV2({ group: params.group ?? "", items, - free_trial: - params.free_trial !== undefined - ? { - duration: params.free_trial.duration_type, - length: params.free_trial.duration_length, - unique_fingerprint: false, - card_required: params.free_trial.card_required, - } - : undefined, + free_trial: notNullish(params.free_trial) + ? { + duration: params.free_trial.duration_type, + length: params.free_trial.duration_length, + unique_fingerprint: false, + card_required: params.free_trial.card_required, + } + : params.free_trial, ...(archived !== undefined && { archived }), }; } diff --git a/shared/api/products/crud/updatePlanParamsV0.ts b/shared/api/products/crud/updatePlanParamsV0.ts deleted file mode 100644 index fcfe95330..000000000 --- a/shared/api/products/crud/updatePlanParamsV0.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { CreatePlanParamsV1Schema } from "@api/products/crud/createPlanParamsV0"; -import { z } from "zod/v4"; - -export const UpdatePlanParamsV1Schema = - CreatePlanParamsV1Schema.partial().extend({ - version: z.number().optional(), - archived: z.boolean().default(false).optional(), - }); - -export const UpdatePlanQuerySchema = z.object({ - version: z.number().optional(), - upsert: z.boolean().optional(), - disable_version: z.boolean().optional(), -}); - -export type UpdatePlanParams = z.infer; -export type UpdatePlanParamsInput = z.input; diff --git a/shared/api/products/crud/updatePlanParamsV1.ts b/shared/api/products/crud/updatePlanParamsV1.ts new file mode 100644 index 000000000..cee104e6a --- /dev/null +++ b/shared/api/products/crud/updatePlanParamsV1.ts @@ -0,0 +1,79 @@ +import { FreeTrialParamsV1Schema } from "@api/common/freeTrial/freeTrialParamsV1"; +import { idRegex } from "@utils/utils"; +import { z } from "zod/v4"; +import { BasePriceParamsSchema } from "../components/basePrice/basePrice"; +import { CreatePlanParamsV1Schema } from "./createPlanParamsV1"; + +// const UpdatePlanBaseFieldsSchema = z.object({ +// name: CreatePlanParamsV1Schema.shape.name.optional(), +// description: CreatePlanParamsV1Schema.shape.description +// .removeDefault() +// .optional(), +// group: CreatePlanParamsV1Schema.shape.group.removeDefault().optional(), +// add_on: CreatePlanParamsV1Schema.shape.add_on.removeDefault().optional(), +// auto_enable: CreatePlanParamsV1Schema.shape.auto_enable +// .removeDefault() +// .optional(), +// price: CreatePlanParamsV1Schema.shape.price.optional(), +// items: CreatePlanParamsV1Schema.shape.items.optional(), +// free_trial: CreatePlanParamsV1Schema.shape.free_trial.optional(), +// }); + +export const UpdatePlanParamsV1Schema = + CreatePlanParamsV1Schema.partial().extend({ + version: z.number().optional(), + archived: z.boolean().default(false).optional(), + price: BasePriceParamsSchema.nullable().optional().meta({ + description: + "The price of the plan. Set to null to remove the base price.", + }), + free_trial: FreeTrialParamsV1Schema.nullable().optional().meta({ + description: + "The free trial of the plan. Set to null to remove the free trial.", + }), + }); + +export const UpdatePlanParamsV2Schema = z + .object({ + plan_id: z + .string() + .nonempty() + .regex(idRegex) + .meta({ + description: "The ID of the plan to update.", + }), + }) + .extend(UpdatePlanParamsV1Schema.omit({ id: true }).shape) + .extend({ + add_on: z.boolean().optional().meta({ + description: "Whether the plan is an add-on.", + }), + auto_enable: z.boolean().optional().meta({ + description: "Whether the plan is automatically enabled.", + }), + + new_plan_id: z + .string() + .nonempty() + .regex(idRegex) + .optional() + .meta({ + description: + "The new ID to use for the plan. Can only be updated if the plan has not been used by any customers.", + }), + + description: z.string().optional().meta({ + internal: true, + }), + }); + +export const UpdatePlanQuerySchema = z.object({ + version: z.number().optional(), + upsert: z.boolean().optional(), + disable_version: z.boolean().optional(), +}); + +export type UpdatePlanParams = z.infer; +export type UpdatePlanParamsInput = z.input; +export type UpdatePlanParamsV2 = z.infer; +export type UpdatePlanParamsV2Input = z.input; diff --git a/shared/api/products/items/apiPlanItemV1.ts b/shared/api/products/items/apiPlanItemV1.ts index 2e2100bad..7d249e763 100644 --- a/shared/api/products/items/apiPlanItemV1.ts +++ b/shared/api/products/items/apiPlanItemV1.ts @@ -11,51 +11,151 @@ import { } from "@models/productV2Models/productItemModels/productItemEnums"; import { z } from "zod/v4"; +export const API_PLAN_ITEM_USAGE_BASED_EXAMPLE = { + featureId: "messages", + included: 100, + unlimited: false, + reset: { + interval: "month", + }, + price: { + amount: 0.5, + interval: "month", + billingUnits: 100, + billingMethod: "usage_based", + maxPurchase: null, + }, + display: { + primaryText: "100 messages", + secondaryText: "then $0.5 per 100 messages", + }, +}; + +export const API_PLAN_ITEM_PREPAID_EXAMPLE = { + featureId: "users", + included: 0, + unlimited: false, + reset: null, + price: { + amount: 10, + interval: "month", + billingUnits: 1, + billingMethod: "prepaid", + maxPurchase: null, + }, + display: { + primaryText: "$10 per Users", + }, +}; + export const ApiPlanItemV1Schema = z .object({ - feature_id: z.string(), - feature: ApiFeatureV0Schema.optional(), + feature_id: z.string().meta({ + description: "The ID of the feature this item configures.", + }), + feature: ApiFeatureV0Schema.optional().meta({ + description: "The full feature object if expanded.", + }), - included: z.number(), - unlimited: z.boolean(), + included: z.number().meta({ + description: + "Number of free units included. For consumable features, balance resets to this number each interval.", + }), + unlimited: z.boolean().meta({ + description: "Whether the customer has unlimited access to this feature.", + }), reset: z .object({ - interval: z.enum(ResetInterval), - interval_count: z.number().optional(), + interval: z.enum(ResetInterval).meta({ + description: + "The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.", + }), + interval_count: z.number().optional().meta({ + description: "Number of intervals between resets. Defaults to 1.", + }), }) - .nullable(), + .nullable() + .meta({ + description: + "Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.", + }), price: z .object({ - amount: z.number().optional(), - tiers: z.array(UsageTierSchema).optional(), + amount: z.number().optional().meta({ + description: + "Price per billing_units after included usage is consumed. Mutually exclusive with tiers.", + }), + tiers: z.array(UsageTierSchema).optional().meta({ + description: + "Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required.", + }), - interval: z.enum(BillingInterval), - interval_count: z.number().optional(), + interval: z.enum(BillingInterval).meta({ + description: + "Billing interval for this price. For consumable features, should match reset.interval.", + }), + interval_count: z.number().optional().meta({ + description: "Number of intervals per billing cycle. Defaults to 1.", + }), - billing_units: z.number(), - billing_method: z.enum(BillingMethod), - max_purchase: z.number().nullable(), + billing_units: z.number().meta({ + description: + "Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200).", + }), + billing_method: z.enum(BillingMethod).meta({ + description: + "'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.", + }), + max_purchase: z.number().nullable().meta({ + description: + "Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.", + }), }) - .nullable(), + .nullable() + .meta({ + description: + "Pricing configuration for usage beyond included units. Null if feature is entirely free.", + }), - display: DisplaySchema.optional(), + display: DisplaySchema.optional().meta({ + description: "Display text for showing this item in pricing pages.", + }), rollover: z .object({ - max: z.number().nullable(), - expiry_duration_type: z.enum(RolloverExpiryDurationType), - expiry_duration_length: z.number().optional(), + max: z.number().nullable().meta({ + description: "Maximum rollover units. Null for unlimited rollover.", + }), + expiry_duration_type: z.enum(RolloverExpiryDurationType).meta({ + description: "When rolled over units expire.", + }), + expiry_duration_length: z.number().optional().meta({ + description: "Number of periods before expiry.", + }), }) - .optional(), + .optional() + .meta({ + description: + "Rollover configuration for unused units. If set, unused included units roll over to the next period.", + }), proration: z .object({ - on_increase: z.enum(OnIncrease).optional(), - on_decrease: z.enum(OnDecrease).optional(), + on_increase: z.enum(OnIncrease).optional().meta({ + description: + "How to handle billing when quantity increases mid-cycle (prepaid features only).", + }), + on_decrease: z.enum(OnDecrease).optional().meta({ + description: + "How to handle credits when quantity decreases mid-cycle (prepaid features only).", + }), }) - .optional(), + .optional() + .meta({ + internal: true, + }), entity_feature_id: z.string().optional().meta({ internal: true, @@ -99,12 +199,8 @@ export const ApiPlanItemV1Schema = z export type ApiPlanItemV1 = z.infer; export const ApiPlanItemV1WithMeta = ApiPlanItemV1Schema.meta({ - id: "PlanFeatureV1", - description: "Plan feature object returned by the API (V1/latest)", - example: { - feature_id: "123", - included: 100, - unlimited: false, - price: null, - }, + id: "PlanItem", + description: + "Configuration for a feature within a plan, defining included units, pricing, and reset behavior.", + example: API_PLAN_ITEM_USAGE_BASED_EXAMPLE, }); diff --git a/shared/api/products/items/crud/createPlanItemParamsV1.ts b/shared/api/products/items/crud/createPlanItemParamsV1.ts index d1ad332f2..a7615b8e9 100644 --- a/shared/api/products/items/crud/createPlanItemParamsV1.ts +++ b/shared/api/products/items/crud/createPlanItemParamsV1.ts @@ -11,51 +11,108 @@ import { z } from "zod/v4"; export const CreatePlanItemParamsV1Schema = z .object({ - feature_id: z.string(), - included: z.number().optional(), - unlimited: z.boolean().optional(), + feature_id: z.string().meta({ + description: "The ID of the feature to configure.", + }), + included: z.number().optional().meta({ + description: + "Number of free units included. Balance resets to this each interval for consumable features.", + }), + unlimited: z.boolean().optional().meta({ + description: "If true, customer has unlimited access to this feature.", + }), reset: z .object({ - interval: z.enum(ResetInterval), - interval_count: z.number().optional(), + interval: z.enum(ResetInterval).meta({ + description: + "Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.", + }), + interval_count: z.number().optional().meta({ + description: "Number of intervals between resets. Defaults to 1.", + }), }) - .optional(), + .optional() + .meta({ + description: + "Reset configuration for consumable features. Omit for non-consumable features like seats.", + }), price: z .object({ - amount: z.number().optional(), - tiers: z.array(UsageTierSchema).optional(), + amount: z.number().optional().meta({ + description: + "Price per billing_units after included usage. Either 'amount' or 'tiers' is required.", + }), + tiers: z.array(UsageTierSchema).optional().meta({ + description: + "Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required.", + }), - interval: z.enum(BillingInterval), - interval_count: z.number().default(1).optional(), + interval: z.enum(BillingInterval).meta({ + description: + "Billing interval. For consumable features, should match reset.interval.", + }), + interval_count: z.number().default(1).optional().meta({ + description: "Number of intervals per billing cycle. Defaults to 1.", + }), - billing_units: z.number().default(1).optional(), - billing_method: z.enum(BillingMethod), - max_purchase: z.number().optional(), + billing_units: z.number().default(1).optional().meta({ + description: + "Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).", + }), + billing_method: z.enum(BillingMethod).meta({ + description: + "'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.", + }), + max_purchase: z.number().optional().meta({ + description: + "Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.", + }), }) - .optional(), + .optional() + .meta({ + description: + "Pricing for usage beyond included units. Omit for free features.", + }), proration: z .object({ - on_increase: z.enum(OnIncrease), - on_decrease: z.enum(OnDecrease), + on_increase: z.enum(OnIncrease).meta({ + description: "Billing behavior when quantity increases mid-cycle.", + }), + on_decrease: z.enum(OnDecrease).meta({ + description: "Credit behavior when quantity decreases mid-cycle.", + }), }) - .optional(), + .optional() + .meta({ + description: + "Proration settings for prepaid features. Controls mid-cycle quantity change billing.", + }), rollover: z .object({ - max: z.number().optional(), - expiry_duration_type: z.enum(RolloverExpiryDurationType), - expiry_duration_length: z.number().optional(), + max: z.number().optional().meta({ + description: "Max rollover units. Omit for unlimited rollover.", + }), + expiry_duration_type: z.enum(RolloverExpiryDurationType).meta({ + description: "When rolled over units expire.", + }), + expiry_duration_length: z.number().optional().meta({ + description: "Number of periods before expiry.", + }), }) - .optional(), + .optional() + .meta({ + description: + "Rollover config for unused units. If set, unused included units carry over.", + }), entity_feature_id: z.string().optional().meta({ internal: true, }), - // Internal entitlement_id: z.string().optional().meta({ internal: true, }),