From 0011fb12b7adbb9d7c53ed33d686c681e11209c9 Mon Sep 17 00:00:00 2001 From: John Yeo Date: Thu, 26 Feb 2026 10:40:45 +0000 Subject: [PATCH] sdk generation for new routes --- .claude/commands/update-autumn-js-route.md | 71 + .../billing/{billingAttach.mdx => attach.mdx} | 0 .../api-reference/balances/updateBalance.mdx | 4 + .../mintlify/api-reference/billing/attach.mdx | 276 ++- .../api-reference/billing/billingAttach.mdx | 348 ---- .../api-reference/billing/billingUpdate.mdx | 6 +- .../api-reference/billing/multiAttach.mdx | 371 ++++ .../api-reference/billing/previewAttach.mdx | 10 +- .../billing/previewMultiAttach.mdx | 379 ++++ .../api-reference/billing/previewUpdate.mdx | 6 +- .../api-reference/billing/setupPayment.mdx | 232 ++- .../mintlify/api-reference/core/check.mdx | 14 + .../mintlify/api-reference/core/track.mdx | 12 + .../customers/getOrCreateCustomer.mdx | 44 +- .../api-reference/customers/listCustomers.mdx | 44 +- .../customers/updateCustomer.mdx | 44 +- .../api-reference/entities/createEntity.mdx | 44 +- .../api-reference/entities/getEntity.mdx | 44 +- .../api-reference/plans/createPlan.mdx | 25 +- .../mintlify/api-reference/plans/getPlan.mdx | 19 +- .../api-reference/plans/listPlans.mdx | 19 +- .../api-reference/plans/updatePlan.mdx | 25 +- apps/docs/mintlify/api/openapi.yml | 1676 ++++++++++++++++- apps/docs/mintlify/docs.json | 6 +- apps/docs/package.json | 2 +- .../app/scenarios/core/use-autumn/page.tsx | 168 +- apps/sdk-test/next.config.ts | 11 +- bun.lock | 1 - .../.speakeasy/code-samples.overlay.yaml | 62 + others/python-sdk/.speakeasy/gen.lock | 934 ++++++--- others/python-sdk/.speakeasy/gen.yaml | 4 +- others/python-sdk/README.md | 6 + .../src/autumn_sdk/_hooks/__init__.py | 1 - .../src/autumn_sdk/_hooks/sdkhooks.py | 2 - others/python-sdk/src/autumn_sdk/balances.py | 6 + others/python-sdk/src/autumn_sdk/billing.py | 812 +++++++- .../src/autumn_sdk/models/__init__.py | 785 ++++++-- .../{billingattachop.py => attachop.py} | 252 ++- .../src/autumn_sdk/models/balance.py | 45 +- .../src/autumn_sdk/models/billingupdateop.py | 50 +- .../src/autumn_sdk/models/checkop.py | 52 +- .../src/autumn_sdk/models/createplanop.py | 149 +- .../src/autumn_sdk/models/getplanop.py | 99 +- .../src/autumn_sdk/models/listplansop.py | 99 +- .../src/autumn_sdk/models/multiattachop.py | 958 ++++++++++ .../python-sdk/src/autumn_sdk/models/plan.py | 99 +- .../src/autumn_sdk/models/previewattachop.py | 58 +- .../autumn_sdk/models/previewmultiattachop.py | 973 ++++++++++ .../src/autumn_sdk/models/previewupdateop.py | 50 +- .../src/autumn_sdk/models/setuppaymentop.py | 683 ++++++- .../src/autumn_sdk/models/updatebalanceop.py | 9 +- .../src/autumn_sdk/models/updateplanop.py | 149 +- packages/autumn-js/package.json | 2 +- .../src/backend/core/routes/routeConfigs.ts | 12 + .../src/backend/core/types/routeTypes.ts | 3 + packages/autumn-js/src/better-auth/index.ts | 3 + .../autumn-js/src/generated/attachSchemas.ts | 276 +++ .../src/generated/billingAttachSchemas.ts | 283 --- packages/autumn-js/src/generated/index.ts | 2 +- .../src/generated/listPlansSchemas.ts | 16 + .../src/react/client/AutumnClient.ts | 22 +- .../src/react/client/IAutumnClient.ts | 17 +- .../hooks/internal/useCustomerActions.ts | 62 +- .../autumn-js/src/react/hooks/useCustomer.ts | 39 +- packages/autumn-js/src/react/index.ts | 3 + packages/autumn-js/src/types/index.ts | 3 + packages/autumn-js/src/types/params.ts | 44 +- packages/openapi/openapi-stripped.yml | 228 ++- packages/openapi/openapi.yml | 228 ++- packages/openapi/utils/zodSchemaGeneration.ts | 2 +- .../openapi/v2.1/contracts/billingContract.ts | 14 +- .../sdk/.speakeasy/code-samples.overlay.yaml | 72 + packages/sdk/.speakeasy/gen.lock | 938 ++++++--- packages/sdk/.speakeasy/gen.yaml | 4 +- packages/sdk/.speakeasy/out.openapi.yaml | 197 +- packages/sdk/.speakeasy/workflow.lock | 10 +- packages/sdk/README.md | 116 ++ packages/sdk/src/funcs/billing-attach.ts | 11 +- .../sdk/src/funcs/billing-multi-attach.ts | 196 ++ .../sdk/src/funcs/billing-preview-attach.ts | 1 + .../src/funcs/billing-preview-multi-attach.ts | 184 ++ packages/sdk/src/hooks/hooks.ts | 3 - .../{billing-attach-op.ts => attach-op.ts} | 578 +++--- packages/sdk/src/models/balance.ts | 41 +- packages/sdk/src/models/billing-update-op.ts | 37 +- packages/sdk/src/models/check-op.ts | 52 +- packages/sdk/src/models/create-plan-op.ts | 140 +- packages/sdk/src/models/get-plan-op.ts | 101 +- packages/sdk/src/models/index.ts | 4 +- packages/sdk/src/models/list-plans-op.ts | 101 +- packages/sdk/src/models/multi-attach-op.ts | 1235 ++++++++++++ packages/sdk/src/models/plan.ts | 96 +- packages/sdk/src/models/preview-attach-op.ts | 44 +- .../sdk/src/models/preview-multi-attach-op.ts | 1282 +++++++++++++ packages/sdk/src/models/preview-update-op.ts | 37 +- packages/sdk/src/models/setup-payment-op.ts | 884 ++++++++- packages/sdk/src/models/update-balance-op.ts | 6 + packages/sdk/src/models/update-plan-op.ts | 140 +- packages/sdk/src/sdk/billing.ts | 88 +- prepaid-volume.md | 22 - .../handleListPlans/handleListPlansV2.ts | 3 + .../internal/products/prices/priceUtils.ts | 58 - shared/api/products/apiPlanV1.ts | 5 +- 103 files changed, 15895 insertions(+), 2288 deletions(-) create mode 100644 .claude/commands/update-autumn-js-route.md rename apps/docs/api-reference-generator/billing/{billingAttach.mdx => attach.mdx} (100%) delete mode 100644 apps/docs/mintlify/api-reference/billing/billingAttach.mdx create mode 100644 apps/docs/mintlify/api-reference/billing/multiAttach.mdx create mode 100644 apps/docs/mintlify/api-reference/billing/previewMultiAttach.mdx rename others/python-sdk/src/autumn_sdk/models/{billingattachop.py => attachop.py} (80%) create mode 100644 others/python-sdk/src/autumn_sdk/models/multiattachop.py create mode 100644 others/python-sdk/src/autumn_sdk/models/previewmultiattachop.py create mode 100644 packages/autumn-js/src/generated/attachSchemas.ts delete mode 100644 packages/autumn-js/src/generated/billingAttachSchemas.ts create mode 100644 packages/sdk/src/funcs/billing-multi-attach.ts create mode 100644 packages/sdk/src/funcs/billing-preview-multi-attach.ts rename packages/sdk/src/models/{billing-attach-op.ts => attach-op.ts} (58%) create mode 100644 packages/sdk/src/models/multi-attach-op.ts create mode 100644 packages/sdk/src/models/preview-multi-attach-op.ts delete mode 100644 prepaid-volume.md diff --git a/.claude/commands/update-autumn-js-route.md b/.claude/commands/update-autumn-js-route.md new file mode 100644 index 000000000..1cff417cd --- /dev/null +++ b/.claude/commands/update-autumn-js-route.md @@ -0,0 +1,71 @@ +--- +description: Update an existing autumn-js route after changes to its API contract, params, or response shape +argument-hint: [route-name e.g. attach, multiAttach, setupPayment] +--- + +# Update Autumn JS Route + +When modifying an existing API endpoint (params, response shape, JSDoc, etc.), check **all** of these locations for consistency. + +## Architecture + +Request flow from React hook to Autumn API: + +``` +React Hook (useCustomer) + → useCustomerActions (redirect logic, URL defaults) + → AutumnClient / httpClient (POST /api/autumn/{routeName}) + → rou3 router (routeBuilder.ts) + → executeRoute (resolveIdentity → inject customerId → SDK method) + → @useautumn/sdk → Autumn API +``` + +- The **backend** is a thin proxy. `routeConfigs.ts` maps route names to `@useautumn/sdk` methods. `executeRoute.ts` auto-injects `customerId` from `resolveIdentity()` before calling the SDK. +- The **React client** (`AutumnClient.ts`) sends POST requests to `{pathPrefix}/{routeName}` with the body as JSON. The route name IS the URL segment (e.g. `multiAttach` maps to `POST /api/autumn/multiAttach`). +- **`useCustomerActions`** wraps client methods with redirect logic and `window.location.href` defaults. It bridges the TanStack Query-based `useCustomer` hook and the imperative billing actions. + +## Files to inspect and update + +| Layer | File | What to check | +|-------|------|---------------| +| ORPC contract | `packages/openapi/v2.1/contracts/billingContract.ts` | Input/output schemas match changes | +| Generated schemas | `packages/autumn-js/src/generated/` | Re-run `bun api` if contract changed | +| Client params | `packages/autumn-js/src/types/params.ts` | Omit/extend fields still correct | +| Type exports | `packages/autumn-js/src/types/index.ts` | Alias still matches | +| React exports | `packages/autumn-js/src/react/index.ts` | Client param type exported | +| Route names | `packages/autumn-js/src/backend/core/types/routeTypes.ts` | `ROUTE_NAMES` has the route | +| Route config | `packages/autumn-js/src/backend/core/routes/routeConfigs.ts` | `sdkMethod` and `bodySchema` still match | +| Client interface | `packages/autumn-js/src/react/client/IAutumnClient.ts` | Method signature matches new types | +| Client impl | `packages/autumn-js/src/react/client/AutumnClient.ts` | Response type matches | +| Hook actions | `packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts` | Action logic handles new fields (redirects, defaults) | +| Hook JSDoc | `packages/autumn-js/src/react/hooks/useCustomer.ts` | `UseCustomerResult` JSDoc describes current behavior | +| Zod schema gen | `packages/openapi/utils/zodSchemaGeneration.ts` | `SCHEMA_SOURCES` sdkFile/outputFile match current SDK model filenames | +| SDK test page | `apps/sdk-test/app/scenarios/core/use-autumn/page.tsx` | Test UI exposes new/changed params | + +## Common update scenarios + +**Param added/removed**: Update `params.ts` type -> check `useCustomerActions` passes it -> update sdk-test inputs. + +**Response shape changed**: Update `IAutumnClient` + `AutumnClient` return types -> update `useCustomer.ts` JSDoc. + +**Redirect behavior changed**: Check `useCustomerActions` redirect logic (`paymentUrl`, `url`, `openInNewTab`). + +**JSDoc only**: Update `useCustomer.ts` `UseCustomerResult` type and the hook's `@returns` summary. + +## Gotchas + +- **Casing**: The SDK uses camelCase everywhere. The backend `buildSdkArgs` passes camelCase directly to the SDK. Never use snake_case in `params.ts`, `IAutumnClient.ts`, or hook types. +- **`ProtectedFields`**: Client param types always `Omit`. The backend injects these via `resolveIdentity`. If you add a new field that should NOT be set by the frontend, add it to the Omit union. +- **`openInNewTab`**: Frontend-only field (not sent to the API). Added via `& { openInNewTab?: boolean }` on client param types that trigger redirects (`attach`, `multiAttach`, `setupPayment`, `updateSubscription`, `openCustomerPortal`). The `useCustomerActions` layer reads it and calls `redirectToUrl`. +- **`successUrl` / `returnUrl` defaults**: Actions in `useCustomerActions` default these to `window.location.href`. If you change this default, update all actions consistently. +- **Route name must match everywhere**: The string in `ROUTE_NAMES`, `routeConfigs[].route`, `AutumnClient`'s `http.request({ route: "..." })`, and the rou3 path segment must all be identical. +- **`bodySchema` is optional**: Only needed if the route is used via the better-auth plugin. Standard routes work without it. +- **Response types come from `@useautumn/sdk`**: Don't create custom response types. Import from the SDK (e.g. `AttachResponse`, `SetupPaymentResponse`). These are auto-generated by Speakeasy. +- **Generated schemas** in `packages/autumn-js/src/generated/` are only for `bodySchema` validation in better-auth. Not all routes need them. +- **operationId renames cause SDK file renames**: When you change an `operationId` in a contract (e.g. `billingAttach` → `attach`), Speakeasy renames the generated model file (e.g. `billing-attach-op.ts` → `attach-op.ts`) and all its exported types (e.g. `BillingAttachResponse` → `AttachResponse`). You **must** update: (1) `packages/openapi/utils/zodSchemaGeneration.ts` — change the `sdkFile` and `outputFile` in `SCHEMA_SOURCES`, (2) delete the old generated schema file from `packages/autumn-js/src/generated/`, and (3) update all imports of the old type names across `IAutumnClient.ts`, `AutumnClient.ts`, `useCustomerActions.ts`, and `useCustomer.ts`. + +## Validation + +```bash +bunx biome check --write +``` diff --git a/apps/docs/api-reference-generator/billing/billingAttach.mdx b/apps/docs/api-reference-generator/billing/attach.mdx similarity index 100% rename from apps/docs/api-reference-generator/billing/billingAttach.mdx rename to apps/docs/api-reference-generator/billing/attach.mdx diff --git a/apps/docs/mintlify/api-reference/balances/updateBalance.mdx b/apps/docs/mintlify/api-reference/balances/updateBalance.mdx index c116235e0..af454923d 100644 --- a/apps/docs/mintlify/api-reference/balances/updateBalance.mdx +++ b/apps/docs/mintlify/api-reference/balances/updateBalance.mdx @@ -29,6 +29,10 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance. + + The usage amount to update. Cannot be combined with remaining or add_to_balance. + + Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. diff --git a/apps/docs/mintlify/api-reference/billing/attach.mdx b/apps/docs/mintlify/api-reference/billing/attach.mdx index 64921cc49..4d950ec41 100644 --- a/apps/docs/mintlify/api-reference/billing/attach.mdx +++ b/apps/docs/mintlify/api-reference/billing/attach.mdx @@ -7,24 +7,79 @@ import { DynamicParamField } from "/components/dynamic-param-field.jsx"; import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + + The attach endpoint subscribes a customer to a plan. It handles new subscriptions, upgrades, and downgrades automatically. For modifying an existing subscription (like changing quantities or canceling), use [update](/api-reference/billing/billingUpdate) instead. + + +### Common Use Cases + + + +```typescript Subscribe to a plan +const response = await autumn.billing.attach({ + customerId: "cus_123", + planId: "pro_plan" +}); + +if (response.paymentUrl) { + // Redirect customer to checkout + window.location.href = response.paymentUrl; +} +``` + +```typescript Custom pricing +const response = await autumn.billing.attach({ + customerId: "cus_123", + planId: "enterprise_plan", + customize: { + price: { + amount: 99900, // $999.00 + interval: "month" + } + } +}); +``` + +```typescript Attach plan with prepaid quantities +const response = await autumn.billing.attach({ + customerId: "cus_123", + planId: "team_plan", + featureQuantities: [ + { featureId: "seats", quantity: 5 } + ] +}); +``` + + + ### Body Parameters The ID of the customer to attach the plan to. - + The ID of the entity to attach the plan to. - + + The ID of the plan. + + + If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. - + + The ID of the feature to set quantity for. + - + + The quantity of the feature. + - + + Whether the customer can adjust the quantity. + @@ -33,90 +88,128 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The version of the plan to attach. - - - - - - - - - - - - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. + Customize the plan to attach. Can override the price, items, free trial, or a combination. + Base price configuration for a plan. - + + Base price amount for the plan. + - + + Billing interval (e.g. 'month', 'year'). + - + + Number of intervals per billing cycle. Defaults to 1. + + Override the items in the plan. - + + 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. 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. + @@ -124,63 +217,130 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + Free trial configuration for a plan. + + + 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. + + + + + - - + Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. - + + When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + - + + If true, enables the plan immediately even though the invoice is not paid yet. + - + + If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + - + + How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. + - + + List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + + + The ID of the reward to apply as a discount. + - + + The promotion code to apply as a discount. + - + + - + + URL to redirect to after successful checkout. + - + + Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + + + + When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + + + + Additional parameters to pass into the creation of the Stripe checkout session. + ### Response - + + The ID of the customer. + - + + The ID of the entity, if the plan was attached to an entity. + + Invoice details if an invoice was created. Only present when a charge was made. - + + The status of the invoice (e.g., 'paid', 'open', 'draft'). + - + + The Stripe invoice ID. + - + + The total amount of the invoice in cents. + - + + The three-letter ISO currency code (e.g., 'usd'). + - + + URL to the hosted invoice page where the customer can view and pay the invoice. + - + + URL to redirect the customer to complete payment. Null if no payment action is required. + + Details about any action required to complete the payment. Present when the payment could not be processed automatically. - + + The type of action required to complete the payment. + - + + A human-readable explanation of why this action is required. + @@ -190,7 +350,7 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx ```json 200 { "customer_id": "cus_123", - "payment_url": null + "payment_url": "https://checkout.stripe.com/..." } ``` diff --git a/apps/docs/mintlify/api-reference/billing/billingAttach.mdx b/apps/docs/mintlify/api-reference/billing/billingAttach.mdx deleted file mode 100644 index 8cf9ef80a..000000000 --- a/apps/docs/mintlify/api-reference/billing/billingAttach.mdx +++ /dev/null @@ -1,348 +0,0 @@ ---- -title: "Attach" -openapi: "openapi POST /v1/billing.attach" ---- - -import { DynamicParamField } from "/components/dynamic-param-field.jsx"; -import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; -import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; - - - The attach endpoint subscribes a customer to a plan. It handles new subscriptions, upgrades, and downgrades automatically. For modifying an existing subscription (like changing quantities or canceling), use [update](/api-reference/billing/billingUpdate) instead. - - -### Common Use Cases - - - -```typescript Subscribe to a plan -const response = await autumn.billing.attach({ - customerId: "cus_123", - planId: "pro_plan" -}); - -if (response.paymentUrl) { - // Redirect customer to checkout - window.location.href = response.paymentUrl; -} -``` - -```typescript Custom pricing -const response = await autumn.billing.attach({ - customerId: "cus_123", - planId: "enterprise_plan", - customize: { - price: { - amount: 99900, // $999.00 - interval: "month" - } - } -}); -``` - -```typescript Attach plan with prepaid quantities -const response = await autumn.billing.attach({ - customerId: "cus_123", - planId: "team_plan", - featureQuantities: [ - { featureId: "seats", quantity: 5 } - ] -}); -``` - - - -### Body Parameters - - - The ID of the customer to attach the plan to. - - - - The ID of the entity to attach the plan to. - - - - The ID of the plan. - - - - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. - - - The ID of the feature to set quantity for. - - - - The quantity of the feature. - - - - Whether the customer can adjust the quantity. - - - - - - - The version of the plan to attach. - - - - Customize the plan to attach. Can override the price, items, free trial, or a combination. - - - Base price configuration for a plan. - - - Base price amount for the plan. - - - - Billing interval (e.g. 'month', 'year'). - - - - Number of intervals per billing cycle. Defaults to 1. - - - - - - - Override the items in the plan. - - - 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 for a plan. - - - 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. - - - - - - - - - - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. - - - When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. - - - - If true, enables the plan immediately even though the invoice is not paid yet. - - - - If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. - - - - - - - How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. - - - - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. - - - The ID of the reward to apply as a discount. - - - - The promotion code to apply as a discount. - - - - - - - URL to redirect to after successful checkout. - - - - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. - - - - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. - - - -### Response - - - The ID of the customer. - - - - The ID of the entity, if the plan was attached to an entity. - - - - Invoice details if an invoice was created. Only present when a charge was made. - - - The status of the invoice (e.g., 'paid', 'open', 'draft'). - - - - The Stripe invoice ID. - - - - The total amount of the invoice in cents. - - - - The three-letter ISO currency code (e.g., 'usd'). - - - - URL to the hosted invoice page where the customer can view and pay the invoice. - - - - - - - URL to redirect the customer to complete payment. Null if no payment action is required. - - - - Details about any action required to complete the payment. Present when the payment could not be processed automatically. - - - The type of action required to complete the payment. - - - - A human-readable explanation of why this action is required. - - - - - - - -```json 200 -{ - "customer_id": "cus_123", - "payment_url": "https://checkout.stripe.com/..." -} -``` - diff --git a/apps/docs/mintlify/api-reference/billing/billingUpdate.mdx b/apps/docs/mintlify/api-reference/billing/billingUpdate.mdx index 86bb99206..9f61be959 100644 --- a/apps/docs/mintlify/api-reference/billing/billingUpdate.mdx +++ b/apps/docs/mintlify/api-reference/billing/billingUpdate.mdx @@ -135,15 +135,19 @@ const response = await autumn.billing.update({ - Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + Tiered pricing. Either 'amount' or 'tiers' is required. + + + + Billing interval. For consumable features, should match reset.interval. diff --git a/apps/docs/mintlify/api-reference/billing/multiAttach.mdx b/apps/docs/mintlify/api-reference/billing/multiAttach.mdx new file mode 100644 index 000000000..98bf6f2b7 --- /dev/null +++ b/apps/docs/mintlify/api-reference/billing/multiAttach.mdx @@ -0,0 +1,371 @@ +--- +title: "Multi Attach" +openapi: "openapi POST /v1/billing.multi_attach" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +### Body Parameters + + + The ID of the customer to attach the plans to. + + + + The ID of the entity to attach the plans to. + + + + The list of plans to attach to the customer. + + + The ID of the plan to attach. + + + + Customize the plan to attach. Can override the price or items. + + + Base price configuration for a plan. + + + Base price amount for the plan. + + + + Billing interval (e.g. 'month', 'year'). + + + + Number of intervals per billing cycle. Defaults to 1. + + + + + + + Override the items in the plan. + + + 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. 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. + + + + + + + + + + + + + If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. + + + The ID of the feature to set quantity for. + + + + The quantity of the feature. + + + + Whether the customer can adjust the quantity. + + + + + + + The version of the plan to attach. + + + + + + + Free trial configuration for a plan. + + + 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. + + + + + + + Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. + + + When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + + + + If true, enables the plan immediately even though the invoice is not paid yet. + + + + If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + + + + + + + List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + + + The ID of the reward to apply as a discount. + + + + The promotion code to apply as a discount. + + + + + + + URL to redirect to after successful checkout. + + + + Additional parameters to pass into the creation of the Stripe checkout session. + + + + Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. + + + + Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + + + + Customer details to set when creating a customer + + + Customer's name + + + + Customer's email address + + + + Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse + + + + Additional metadata for the customer + + + + Stripe customer ID if you already have one + + + + Whether to create the customer in Stripe + + + + The ID of the free plan to auto-enable for the customer + + + + Whether to send email receipts to this customer + + + + + + + + + The feature ID that this entity is associated with + + + + Name of the entity + + + + + + +### Response + + + The ID of the customer. + + + + The ID of the entity, if the plan was attached to an entity. + + + + Invoice details if an invoice was created. Only present when a charge was made. + + + The status of the invoice (e.g., 'paid', 'open', 'draft'). + + + + The Stripe invoice ID. + + + + The total amount of the invoice in cents. + + + + The three-letter ISO currency code (e.g., 'usd'). + + + + URL to the hosted invoice page where the customer can view and pay the invoice. + + + + + + + URL to redirect the customer to complete payment. Null if no payment action is required. + + + + Details about any action required to complete the payment. Present when the payment could not be processed automatically. + + + The type of action required to complete the payment. + + + + A human-readable explanation of why this action is required. + + + + + + + +```json 200 +{ + "customer_id": "cus_123", + "invoice": { + "status": "paid", + "stripe_id": "in_1234", + "total": 4900, + "currency": "usd", + "hosted_invoice_url": "https://invoice.stripe.com/..." + }, + "payment_url": null +} +``` + diff --git a/apps/docs/mintlify/api-reference/billing/previewAttach.mdx b/apps/docs/mintlify/api-reference/billing/previewAttach.mdx index ae415e305..dc88a2752 100644 --- a/apps/docs/mintlify/api-reference/billing/previewAttach.mdx +++ b/apps/docs/mintlify/api-reference/billing/previewAttach.mdx @@ -101,15 +101,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + Tiered pricing. Either 'amount' or 'tiers' is required. + + + + Billing interval. For consumable features, should match reset.interval. @@ -237,6 +241,10 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + + Additional parameters to pass into the creation of the Stripe checkout session. + + ### Response diff --git a/apps/docs/mintlify/api-reference/billing/previewMultiAttach.mdx b/apps/docs/mintlify/api-reference/billing/previewMultiAttach.mdx new file mode 100644 index 000000000..d7cde8bab --- /dev/null +++ b/apps/docs/mintlify/api-reference/billing/previewMultiAttach.mdx @@ -0,0 +1,379 @@ +--- +title: "Preview Multi Attach" +openapi: "openapi POST /v1/billing.preview_multi_attach" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +### Body Parameters + + + The ID of the customer to attach the plans to. + + + + The ID of the entity to attach the plans to. + + + + The list of plans to attach to the customer. + + + The ID of the plan to attach. + + + + Customize the plan to attach. Can override the price or items. + + + Base price configuration for a plan. + + + Base price amount for the plan. + + + + Billing interval (e.g. 'month', 'year'). + + + + Number of intervals per billing cycle. Defaults to 1. + + + + + + + Override the items in the plan. + + + 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. 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. + + + + + + + + + + + + + If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. + + + The ID of the feature to set quantity for. + + + + The quantity of the feature. + + + + Whether the customer can adjust the quantity. + + + + + + + The version of the plan to attach. + + + + + + + Free trial configuration for a plan. + + + 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. + + + + + + + Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. + + + When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + + + + If true, enables the plan immediately even though the invoice is not paid yet. + + + + If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + + + + + + + List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + + + The ID of the reward to apply as a discount. + + + + The promotion code to apply as a discount. + + + + + + + URL to redirect to after successful checkout. + + + + Additional parameters to pass into the creation of the Stripe checkout session. + + + + Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. + + + + Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + + + + Customer details to set when creating a customer + + + Customer's name + + + + Customer's email address + + + + Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse + + + + Additional metadata for the customer + + + + Stripe customer ID if you already have one + + + + Whether to create the customer in Stripe + + + + The ID of the free plan to auto-enable for the customer + + + + Whether to send email receipts to this customer + + + + + + + + + The feature ID that this entity is associated with + + + + Name of the entity + + + + + + +### Response + + + The ID of the customer. + + + + List of line items for the current billing period. + + + The title of the line item. + + + + A detailed description of the line item. + + + + The amount in cents for this line item. + + + + List of discounts applied to this line item. + + + + + + + + + + + + + + + + + The total amount in cents for the current billing period. + + + + The three-letter ISO currency code (e.g., 'usd'). + + + + Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. + + + Unix timestamp (milliseconds) when the next billing cycle starts. + + + + The total amount in cents for the next cycle. + + + + + + + +```json 200 +{ + "customerId": "charles", + "lineItems": [ + { + "title": "Pro seed", + "description": "Pro seed - Base Price (from 18 Feb 2026 to 18 Mar 2026)", + "amount": 20, + "discounts": [] + } + ], + "total": 20, + "currency": "usd" +} +``` + diff --git a/apps/docs/mintlify/api-reference/billing/previewUpdate.mdx b/apps/docs/mintlify/api-reference/billing/previewUpdate.mdx index 76c9b332c..e57ceb1d6 100644 --- a/apps/docs/mintlify/api-reference/billing/previewUpdate.mdx +++ b/apps/docs/mintlify/api-reference/billing/previewUpdate.mdx @@ -101,15 +101,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + Tiered pricing. Either 'amount' or 'tiers' is required. + + + + Billing interval. For consumable features, should match reset.interval. diff --git a/apps/docs/mintlify/api-reference/billing/setupPayment.mdx b/apps/docs/mintlify/api-reference/billing/setupPayment.mdx index 7edf27002..25d8e1854 100644 --- a/apps/docs/mintlify/api-reference/billing/setupPayment.mdx +++ b/apps/docs/mintlify/api-reference/billing/setupPayment.mdx @@ -10,53 +10,213 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx ### Body Parameters - The ID of the customer + The ID of the customer to attach the plan to. - - URL to redirect to after successful payment setup. Must start with either http:// or https:// + + The ID of the entity to attach the plan to. - - Customer details to set when creating a customer + + If specified, the plan will be attached to the customer after setup. + + + + If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. - - Customer's name + + The ID of the feature to set quantity for. - - Customer's email address + + The quantity of the feature. - - Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse - - - - Additional metadata for the customer - - - - Stripe customer ID if you already have one - - - - Whether to create the customer in Stripe - - - - The ID of the free plan to auto-enable for the customer - - - - Whether to send email receipts to this customer + + Whether the customer can adjust the quantity. + + The version of the plan to attach. + + + + Customize the plan to attach. Can override the price, items, free trial, or a combination. + + + Base price configuration for a plan. + + + Base price amount for the plan. + + + + Billing interval (e.g. 'month', 'year'). + + + + Number of intervals per billing cycle. Defaults to 1. + + + + + + + Override the items in the plan. + + + 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. 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 for a plan. + + + 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. + + + + + + + + + + How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. + + + + List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + + + The ID of the reward to apply as a discount. + + + + The promotion code to apply as a discount. + + + + + + + URL to redirect to after successful checkout. + + - Additional parameters for the checkout session + Additional parameters to pass into the creation of the Stripe checkout session. @@ -66,8 +226,12 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The ID of the customer + + The ID of the entity the plan (if specified) will be attached to after setup. + + - URL to the payment setup page + URL to redirect the customer to setup their payment. @@ -75,7 +239,7 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx ```json 200 { "customer_id": "cus_123", - "payment_url": "https://checkout.stripe.com/..." + "url": "https://checkout.stripe.com/..." } ``` diff --git a/apps/docs/mintlify/api-reference/core/check.mdx b/apps/docs/mintlify/api-reference/core/check.mdx index 88c62672c..21cfe060a 100644 --- a/apps/docs/mintlify/api-reference/core/check.mdx +++ b/apps/docs/mintlify/api-reference/core/check.mdx @@ -244,9 +244,15 @@ const { allowed } = await autumn.check({ + + + + How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). + + The number of units per billing increment (eg. $9 / 250 units). @@ -390,9 +396,17 @@ const { allowed } = await autumn.check({ The price of the product item for this tier. + + A flat fee charged for this tier, in addition to the per-unit amount. + + + + How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). Defaults to graduated. + + Whether the feature should be prepaid upfront or billed for how much they use end of billing period. diff --git a/apps/docs/mintlify/api-reference/core/track.mdx b/apps/docs/mintlify/api-reference/core/track.mdx index 59c740e81..78e45140c 100644 --- a/apps/docs/mintlify/api-reference/core/track.mdx +++ b/apps/docs/mintlify/api-reference/core/track.mdx @@ -243,9 +243,15 @@ await autumn.track({ + + + + How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). + + The number of units per billing increment (eg. $9 / 250 units). @@ -441,9 +447,15 @@ await autumn.track({ + + + + How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). + + The number of units per billing increment (eg. $9 / 250 units). diff --git a/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx b/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx index b122de129..f118f94ec 100644 --- a/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx +++ b/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx @@ -245,15 +245,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -346,6 +350,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + @@ -553,15 +570,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -654,6 +675,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + @@ -832,9 +866,15 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). + + The number of units per billing increment (eg. $9 / 250 units). diff --git a/apps/docs/mintlify/api-reference/customers/listCustomers.mdx b/apps/docs/mintlify/api-reference/customers/listCustomers.mdx index f907f87fe..726deebef 100644 --- a/apps/docs/mintlify/api-reference/customers/listCustomers.mdx +++ b/apps/docs/mintlify/api-reference/customers/listCustomers.mdx @@ -230,15 +230,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -331,6 +335,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + @@ -538,15 +555,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -639,6 +660,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + @@ -817,9 +851,15 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). + + The number of units per billing increment (eg. $9 / 250 units). diff --git a/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx b/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx index 2d91e2023..d22fd709c 100644 --- a/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx +++ b/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx @@ -233,15 +233,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -334,6 +338,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + @@ -541,15 +558,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -642,6 +663,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + @@ -820,9 +854,15 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). + + The number of units per billing increment (eg. $9 / 250 units). diff --git a/apps/docs/mintlify/api-reference/entities/createEntity.mdx b/apps/docs/mintlify/api-reference/entities/createEntity.mdx index a281c6d69..575592dd8 100644 --- a/apps/docs/mintlify/api-reference/entities/createEntity.mdx +++ b/apps/docs/mintlify/api-reference/entities/createEntity.mdx @@ -244,15 +244,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -345,6 +349,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + @@ -551,15 +568,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -652,6 +673,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + @@ -829,9 +863,15 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). + + The number of units per billing increment (eg. $9 / 250 units). diff --git a/apps/docs/mintlify/api-reference/entities/getEntity.mdx b/apps/docs/mintlify/api-reference/entities/getEntity.mdx index 39c031640..ef7145749 100644 --- a/apps/docs/mintlify/api-reference/entities/getEntity.mdx +++ b/apps/docs/mintlify/api-reference/entities/getEntity.mdx @@ -198,15 +198,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -299,6 +303,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + @@ -505,15 +522,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -606,6 +627,19 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + @@ -783,9 +817,15 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). + + The number of units per billing increment (eg. $9 / 250 units). diff --git a/apps/docs/mintlify/api-reference/plans/createPlan.mdx b/apps/docs/mintlify/api-reference/plans/createPlan.mdx index b595a61a8..c4ef018c6 100644 --- a/apps/docs/mintlify/api-reference/plans/createPlan.mdx +++ b/apps/docs/mintlify/api-reference/plans/createPlan.mdx @@ -219,15 +219,19 @@ await autumn.plans.create({ - Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + Tiered pricing. Either 'amount' or 'tiers' is required. + + + + Billing interval. For consumable features, should match reset.interval. @@ -454,15 +458,19 @@ await autumn.plans.create({ - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -555,6 +563,19 @@ await autumn.plans.create({ If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + ```json 200 diff --git a/apps/docs/mintlify/api-reference/plans/getPlan.mdx b/apps/docs/mintlify/api-reference/plans/getPlan.mdx index 48253aa2c..a99a26a76 100644 --- a/apps/docs/mintlify/api-reference/plans/getPlan.mdx +++ b/apps/docs/mintlify/api-reference/plans/getPlan.mdx @@ -188,15 +188,19 @@ const plan = await autumn.plans.get({ - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -289,6 +293,19 @@ const plan = await autumn.plans.get({ If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + ```json 200 diff --git a/apps/docs/mintlify/api-reference/plans/listPlans.mdx b/apps/docs/mintlify/api-reference/plans/listPlans.mdx index b4d600a6e..b42524bdd 100644 --- a/apps/docs/mintlify/api-reference/plans/listPlans.mdx +++ b/apps/docs/mintlify/api-reference/plans/listPlans.mdx @@ -205,15 +205,19 @@ const plans = await autumn.plans.list({ - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -306,6 +310,19 @@ const plans = await autumn.plans.list({ If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + diff --git a/apps/docs/mintlify/api-reference/plans/updatePlan.mdx b/apps/docs/mintlify/api-reference/plans/updatePlan.mdx index 9d1117556..8e1c14ba5 100644 --- a/apps/docs/mintlify/api-reference/plans/updatePlan.mdx +++ b/apps/docs/mintlify/api-reference/plans/updatePlan.mdx @@ -146,15 +146,19 @@ await autumn.plans.update({ - Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + Tiered pricing. Either 'amount' or 'tiers' is required. + + + + Billing interval. For consumable features, should match reset.interval. @@ -389,15 +393,19 @@ await autumn.plans.update({ - Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. + + + + Billing interval for this price. For consumable features, should match reset.interval. @@ -490,6 +498,19 @@ await autumn.plans.update({ If this is a variant, the ID of the base plan it was created from. + + + + Whether a free trial is available for this customer. + + + + The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + + + + + ```json 200 diff --git a/apps/docs/mintlify/api/openapi.yml b/apps/docs/mintlify/api/openapi.yml index 76b1aba18..560e48328 100644 --- a/apps/docs/mintlify/api/openapi.yml +++ b/apps/docs/mintlify/api/openapi.yml @@ -672,12 +672,20 @@ components: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or 'amount' is + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' is required. + tier_behavior: + enum: + - graduated + - volume interval: enum: - one_off @@ -798,6 +806,27 @@ components: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -996,10 +1025,20 @@ components: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount description: Tiered pricing configuration if applicable. + tier_behavior: + enum: + - graduated + - volume + description: "How tiers are applied: graduated (split across bands) or volume + (flat rate for the matched tier)." billing_units: type: number description: The number of units per billing increment (eg. $9 / 250 units). @@ -2104,11 +2143,18 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. + tier_behavior: + enum: + - graduated + - volume interval: enum: - one_off @@ -2451,12 +2497,20 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or - 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' + is required. + tier_behavior: + enum: + - graduated + - volume interval: enum: - one_off @@ -2579,6 +2633,27 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -2927,12 +3002,20 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or - 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' + is required. + tier_behavior: + enum: + - graduated + - volume interval: enum: - one_off @@ -3055,6 +3138,27 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -3383,12 +3487,20 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' is required. + tier_behavior: + enum: + - graduated + - volume interval: enum: - one_off @@ -3513,6 +3625,27 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -3732,11 +3865,18 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. + tier_behavior: + enum: + - graduated + - volume interval: enum: - one_off @@ -4065,12 +4205,20 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or - 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' + is required. + tier_behavior: + enum: + - graduated + - volume interval: enum: - one_off @@ -4193,6 +4341,27 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -5163,7 +5332,7 @@ paths: res = autumn.features.delete(feature_id="old-feature") /v1/billing.attach: post: - operationId: billingAttach + operationId: attach description: >- Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. @@ -5301,11 +5470,18 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. + tier_behavior: + enum: + - graduated + - volume interval: enum: - one_off @@ -5475,6 +5651,13 @@ paths: 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + checkout_session_params: + type: object + propertyNames: + type: string + additionalProperties: {} + description: Additional parameters to pass into the creation of the Stripe + checkout session. required: - customer_id - plan_id @@ -5592,6 +5775,503 @@ paths: customer_id="cus_123", plan_id="pro_plan", ) + /v1/billing.multi_attach: + post: + operationId: multiAttach + description: >- + Attaches multiple plans to a customer in a single request. Creates a + single Stripe subscription with all plans consolidated. + + + Use this endpoint when you need to subscribe a customer to multiple + plans at once, such as a base plan plus add-ons, or to create a bundle + of products. + tags: + - billing + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer to attach the plans to. + entity_id: + type: string + description: The ID of the entity to attach the plans to. + plans: + type: array + minItems: 1 + items: + type: object + properties: + plan_id: + type: string + description: The ID of the plan to attach. + customize: + type: object + properties: + 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 + title: BasePrice + description: Base price configuration for a plan. + - type: "null" + description: Override the base price of the plan. Pass 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 + flat_amount: + anyOf: + - type: number + - type: "null" + required: + - to + - amount + description: Tiered pricing. Either 'amount' or 'tiers' is required. + tier_behavior: + enum: + - graduated + - volume + 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 + title: PlanItem + description: Configuration for a feature item in a plan, including usage limits, + pricing, and rollover settings. + description: Override the items in the plan. + description: Customize the plan to attach. Can override the price or items. + feature_quantities: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature to set quantity for. + quantity: + type: number + minimum: 0 + description: The quantity of the feature. + adjustable: + type: boolean + description: Whether the customer can adjust the quantity. + required: + - feature_id + title: FeatureQuantity + description: Quantity configuration for a prepaid feature. + description: If this plan contains prepaid features, use this field to specify + the quantity of each prepaid feature. + version: + type: number + description: The version of the plan to attach. + required: + - plan_id + description: The list of plans to attach to the customer. + 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 + title: FreeTrialParams + description: Free trial configuration for a plan. + - type: "null" + description: Free trial configuration applied to all plans. Pass an object to + set a custom trial, or null to remove any trial. + invoice_mode: + type: object + properties: + enabled: + type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. + enable_plan_immediately: + type: boolean + default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. + finalize: + type: boolean + default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. + required: + - enabled + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. + discounts: + type: array + items: + type: object + properties: + reward_id: + type: string + description: The ID of the reward to apply as a discount. + promotion_code: + type: string + description: The promotion code to apply as a discount. + title: AttachDiscount + description: A discount to apply. Can be either a reward ID or a promotion code. + description: List of discounts to apply. Each discount can be an Autumn reward + ID, Stripe coupon ID, or Stripe promotion code. + success_url: + type: string + description: URL to redirect to after successful checkout. + checkout_session_params: + type: object + propertyNames: + type: string + additionalProperties: {} + description: Additional parameters to pass into the creation of the Stripe + checkout session. + redirect_mode: + enum: + - always + - if_required + - never + description: Controls when to return a checkout URL. 'always' returns a URL even + if payment succeeds, 'if_required' only when payment action + is needed, 'never' disables redirects. + default: if_required + new_billing_subscription: + type: boolean + description: Only applicable when the customer has an existing Stripe + subscription. If true, creates a new separate subscription + instead of merging into the existing one. + customer_data: + $ref: "#/components/schemas/CustomerData" + entity_data: + type: object + properties: + feature_id: + type: string + description: The feature ID that this entity is associated with + name: + type: string + description: Name of the entity + required: + - feature_id + required: + - customer_id + - plans + title: MultiAttachParams + examples: + - &a28 + customer_id: cus_123 + plans: + - plan_id: pro_plan + - plan_id: addon_seats + feature_quantities: + - feature_id: seats + quantity: 5 + example: *a28 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer. + entity_id: + type: string + description: The ID of the entity, if the plan was attached to an entity. + invoice: + type: object + properties: + status: + anyOf: + - type: string + - type: "null" + description: The status of the invoice (e.g., 'paid', 'open', 'draft'). + stripe_id: + type: string + description: The Stripe invoice ID. + total: + type: number + description: The total amount of the invoice in cents. + currency: + type: string + description: The three-letter ISO currency code (e.g., 'usd'). + hosted_invoice_url: + anyOf: + - type: string + - type: "null" + description: URL to the hosted invoice page where the customer can view and pay + the invoice. + required: + - status + - stripe_id + - total + - currency + - hosted_invoice_url + description: Invoice details if an invoice was created. Only present when a + charge was made. + payment_url: + anyOf: + - type: string + - type: "null" + description: URL to redirect the customer to complete payment. Null if no + payment action is required. + required_action: + type: object + properties: + code: + enum: + - 3ds_required + - payment_method_required + - payment_failed + description: The type of action required to complete the payment. + reason: + type: string + description: A human-readable explanation of why this action is required. + required: + - code + - reason + description: Details about any action required to complete the payment. Present + when the payment could not be processed automatically. + required: + - customer_id + - payment_url + examples: + - &a29 + customer_id: cus_123 + invoice: + status: paid + stripe_id: in_1234 + total: 4900 + currency: usd + hosted_invoice_url: https://invoice.stripe.com/... + payment_url: null + example: *a29 + x-speakeasy-name-override: multiAttach + 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.multiAttach({ + customerId: "cus_123", + plans: [ + { + planId: "pro_plan", + }, + { + planId: "addon_seats", + featureQuantities: [ + { + featureId: "seats", + quantity: 5, + }, + ], + }, + ], + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.billing.multi_attach( + customer_id="cus_123", + plans=[ + { + "plan_id": "pro_plan", + }, + { + "plan_id": "addon_seats", + "feature_quantities": [ + { + "feature_id": "seats", + "quantity": 5, + }, + ], + }, + ], + redirect_mode="if_required", + ) /v1/billing.preview_attach: post: operationId: previewAttach @@ -5732,11 +6412,18 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. + tier_behavior: + enum: + - graduated + - volume interval: enum: - one_off @@ -5906,15 +6593,22 @@ paths: 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + checkout_session_params: + type: object + propertyNames: + type: string + additionalProperties: {} + description: Additional parameters to pass into the creation of the Stripe + checkout session. required: - customer_id - plan_id title: PreviewAttachParams examples: - - &a28 + - &a30 customer_id: cus_123 plan_id: pro_plan - example: *a28 + example: *a30 responses: "200": description: OK @@ -5988,7 +6682,7 @@ paths: - total - currency examples: - - &a29 + - &a31 customerId: charles lineItems: - title: Pro seed @@ -5997,7 +6691,7 @@ paths: discounts: [] total: 20 currency: usd - example: *a29 + example: *a31 x-speakeasy-name-override: previewAttach parameters: - name: x-api-version @@ -6030,6 +6724,503 @@ paths: customer_id="cus_123", plan_id="pro_plan", ) + /v1/billing.preview_multi_attach: + post: + operationId: previewMultiAttach + description: >- + Previews the billing changes that would occur when attaching multiple + plans, without actually making any changes. + + + Use this endpoint to show customers what they will be charged before + confirming a multi-plan subscription. + tags: + - billing + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer to attach the plans to. + entity_id: + type: string + description: The ID of the entity to attach the plans to. + plans: + type: array + minItems: 1 + items: + type: object + properties: + plan_id: + type: string + description: The ID of the plan to attach. + customize: + type: object + properties: + 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 + title: BasePrice + description: Base price configuration for a plan. + - type: "null" + description: Override the base price of the plan. Pass 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 + flat_amount: + anyOf: + - type: number + - type: "null" + required: + - to + - amount + description: Tiered pricing. Either 'amount' or 'tiers' is required. + tier_behavior: + enum: + - graduated + - volume + 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 + title: PlanItem + description: Configuration for a feature item in a plan, including usage limits, + pricing, and rollover settings. + description: Override the items in the plan. + description: Customize the plan to attach. Can override the price or items. + feature_quantities: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature to set quantity for. + quantity: + type: number + minimum: 0 + description: The quantity of the feature. + adjustable: + type: boolean + description: Whether the customer can adjust the quantity. + required: + - feature_id + title: FeatureQuantity + description: Quantity configuration for a prepaid feature. + description: If this plan contains prepaid features, use this field to specify + the quantity of each prepaid feature. + version: + type: number + description: The version of the plan to attach. + required: + - plan_id + description: The list of plans to attach to the customer. + 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 + title: FreeTrialParams + description: Free trial configuration for a plan. + - type: "null" + description: Free trial configuration applied to all plans. Pass an object to + set a custom trial, or null to remove any trial. + invoice_mode: + type: object + properties: + enabled: + type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. + enable_plan_immediately: + type: boolean + default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. + finalize: + type: boolean + default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. + required: + - enabled + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. + discounts: + type: array + items: + type: object + properties: + reward_id: + type: string + description: The ID of the reward to apply as a discount. + promotion_code: + type: string + description: The promotion code to apply as a discount. + title: AttachDiscount + description: A discount to apply. Can be either a reward ID or a promotion code. + description: List of discounts to apply. Each discount can be an Autumn reward + ID, Stripe coupon ID, or Stripe promotion code. + success_url: + type: string + description: URL to redirect to after successful checkout. + checkout_session_params: + type: object + propertyNames: + type: string + additionalProperties: {} + description: Additional parameters to pass into the creation of the Stripe + checkout session. + redirect_mode: + enum: + - always + - if_required + - never + description: Controls when to return a checkout URL. 'always' returns a URL even + if payment succeeds, 'if_required' only when payment action + is needed, 'never' disables redirects. + default: if_required + new_billing_subscription: + type: boolean + description: Only applicable when the customer has an existing Stripe + subscription. If true, creates a new separate subscription + instead of merging into the existing one. + customer_data: + $ref: "#/components/schemas/CustomerData" + entity_data: + type: object + properties: + feature_id: + type: string + description: The feature ID that this entity is associated with + name: + type: string + description: Name of the entity + required: + - feature_id + required: + - customer_id + - plans + title: PreviewMultiAttachParams + examples: + - &a32 + customer_id: cus_123 + plans: + - plan_id: pro_plan + - plan_id: addon_seats + feature_quantities: + - feature_id: seats + quantity: 5 + example: *a32 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer. + line_items: + type: array + items: + type: object + properties: + title: + type: string + description: The title of the line item. + description: + type: string + description: A detailed description of the line item. + amount: + type: number + description: The amount in cents for this line item. + discounts: + type: array + items: + type: object + properties: + amountOff: + type: number + percentOff: + type: number + stripeCouponId: + type: string + couponName: + type: string + required: + - amountOff + default: [] + description: List of discounts applied to this line item. + required: + - title + - description + - amount + description: List of line items for the current billing period. + total: + type: number + description: The total amount in cents for the current billing period. + currency: + type: string + description: The three-letter ISO currency code (e.g., 'usd'). + next_cycle: + type: object + properties: + starts_at: + type: number + description: Unix timestamp (milliseconds) when the next billing cycle starts. + total: + type: number + description: The total amount in cents for the next cycle. + required: + - starts_at + - total + description: Preview of the next billing cycle, if applicable. This shows what + the customer will be charged in subsequent cycles. + required: + - customer_id + - line_items + - total + - currency + examples: + - &a33 + customerId: charles + lineItems: + - title: Pro seed + description: Pro seed - Base Price (from 18 Feb 2026 to 18 Mar 2026) + amount: 20 + discounts: [] + total: 20 + currency: usd + example: *a33 + x-speakeasy-name-override: previewMultiAttach + 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.previewMultiAttach({ + customerId: "cus_123", + plans: [ + { + planId: "pro_plan", + }, + { + planId: "addon_seats", + featureQuantities: [ + { + featureId: "seats", + quantity: 5, + }, + ], + }, + ], + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.billing.preview_multi_attach( + customer_id="cus_123", + plans=[ + { + "plan_id": "pro_plan", + }, + { + "plan_id": "addon_seats", + "feature_quantities": [ + { + "feature_id": "seats", + "quantity": 5, + }, + ], + }, + ], + redirect_mode="if_required", + ) /v1/billing.update: post: operationId: billingUpdate @@ -6170,11 +7361,18 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. + tier_behavior: + enum: + - graduated + - volume interval: enum: - one_off @@ -6326,13 +7524,13 @@ paths: - plan_id title: UpdateSubscriptionParams examples: - - &a30 + - &a34 customer_id: cus_123 plan_id: pro_plan feature_quantities: - feature_id: seats quantity: 10 - example: *a30 + example: *a34 responses: "200": description: OK @@ -6405,7 +7603,7 @@ paths: - customer_id - payment_url examples: - - &a31 + - &a35 customer_id: cus_123 invoice: status: paid @@ -6414,7 +7612,7 @@ paths: currency: usd hosted_invoice_url: https://invoice.stripe.com/... payment_url: null - example: *a31 + example: *a35 x-speakeasy-name-override: update parameters: - name: x-api-version @@ -6599,11 +7797,18 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. + tier_behavior: + enum: + - graduated + - volume interval: enum: - one_off @@ -6755,13 +7960,13 @@ paths: - plan_id title: PreviewUpdateParams examples: - - &a32 + - &a36 customer_id: cus_123 plan_id: pro_plan feature_quantities: - feature_id: seats quantity: 15 - example: *a32 + example: *a36 responses: "200": description: OK @@ -6835,7 +8040,7 @@ paths: - total - currency examples: - - &a33 + - &a37 customerId: charles lineItems: - title: Pro seed @@ -6844,7 +8049,7 @@ paths: discounts: [] total: 20 currency: usd - example: *a33 + example: *a37 x-speakeasy-name-override: previewUpdate parameters: - name: x-api-version @@ -6918,10 +8123,10 @@ paths: - customer_id title: OpenCustomerPortalParams examples: - - &a34 + - &a38 customer_id: cus_123 return_url: https://useautumn.com - example: *a34 + example: *a38 responses: "200": description: OK @@ -6940,10 +8145,10 @@ paths: - customer_id - url examples: - - &a35 + - &a39 customer_id: cus_123 url: https://billing.stripe.com/session/... - example: *a35 + example: *a39 x-speakeasy-name-override: openCustomerPortal parameters: - name: x-api-version @@ -6992,27 +8197,286 @@ paths: properties: customer_id: type: string - description: The ID of the customer + description: The ID of the customer to attach the plan to. + entity_id: + type: string + description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: If specified, the plan will be attached to the customer after + setup. + feature_quantities: + type: array + items: + type: object + properties: + feature_id: + type: string + description: The ID of the feature to set quantity for. + quantity: + type: number + minimum: 0 + description: The quantity of the feature. + adjustable: + type: boolean + description: Whether the customer can adjust the quantity. + required: + - feature_id + title: FeatureQuantity + description: Quantity configuration for a prepaid feature. + description: If this plan contains prepaid features, use this field to specify + the quantity of each prepaid feature. This quantity includes + the included amount and billing units defined when setting + up the plan. + version: + type: number + description: The version of the plan to attach. + customize: + type: object + properties: + 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 + title: BasePrice + description: Base price configuration for a plan. + - type: "null" + description: Override the base price of the plan. Pass 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 + flat_amount: + anyOf: + - type: number + - type: "null" + required: + - to + - amount + description: Tiered pricing. Either 'amount' or 'tiers' is required. + tier_behavior: + enum: + - graduated + - volume + 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 + title: PlanItem + description: Configuration for a feature item in a plan, including usage limits, + pricing, and rollover settings. + description: Override the items in the plan. + 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 + title: FreeTrialParams + description: Free trial configuration for a plan. + - type: "null" + description: Override the plan's default free trial. Pass an object to set a + custom trial, or null to remove the trial entirely. + description: Customize the plan to attach. Can override the price, items, free + trial, or a combination. + proration_behavior: + enum: + - prorate_immediately + - none + description: How to handle proration when updating an existing subscription. + 'prorate_immediately' charges/credits prorated amounts now, + 'none' skips creating any charges. + discounts: + type: array + items: + type: object + properties: + reward_id: + type: string + description: The ID of the reward to apply as a discount. + promotion_code: + type: string + description: The promotion code to apply as a discount. + title: AttachDiscount + description: A discount to apply. Can be either a reward ID or a promotion code. + description: List of discounts to apply. Each discount can be an Autumn reward + ID, Stripe coupon ID, or Stripe promotion code. 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" + description: URL to redirect to after successful checkout. checkout_session_params: type: object propertyNames: type: string additionalProperties: {} - description: Additional parameters for the checkout session + description: Additional parameters to pass into the creation of the Stripe + checkout session. required: - customer_id title: SetupPaymentParams examples: - - &a36 + - &a40 customer_id: cus_123 success_url: https://example.com/account/billing - example: *a36 + example: *a40 responses: "200": description: OK @@ -7024,17 +8488,22 @@ paths: customer_id: type: string description: The ID of the customer + entity_id: + type: string + description: The ID of the entity the plan (if specified) will be attached to + after setup. url: type: string - description: URL to the payment setup page + description: URL to redirect the customer to setup their payment. required: - customer_id - url + title: SetupPaymentResponse examples: - - &a37 + - &a41 customer_id: cus_123 - payment_url: https://checkout.stripe.com/... - example: *a37 + url: https://checkout.stripe.com/... + example: *a41 x-speakeasy-name-override: setupPayment parameters: - name: x-api-version @@ -7132,13 +8601,13 @@ paths: - feature_id title: CreateBalanceParams examples: - - &a38 + - &a42 customer_id: cus_123 feature_id: api_calls included: 1000 reset: interval: month - example: *a38 + example: *a42 responses: "200": description: OK @@ -7222,6 +8691,10 @@ paths: type: number description: Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance. + usage: + type: number + description: The usage amount to update. Cannot be combined with remaining or + add_to_balance. interval: enum: - one_off @@ -7241,11 +8714,11 @@ paths: - feature_id title: UpdateBalanceParams examples: - - &a39 + - &a43 customer_id: cus_123 feature_id: api_calls remaining: 5 - example: *a39 + example: *a43 responses: "200": description: OK @@ -7343,14 +8816,14 @@ paths: - feature_id title: CheckParams examples: - - &a40 + - &a44 customer_id: cus_123 feature_id: messages - customer_id: cus_123 feature_id: messages required_balance: 3 send_event: true - example: *a40 + example: *a44 responses: "200": description: OK @@ -7519,12 +8992,27 @@ paths: amount: type: number description: The price of the product item for this tier. + flat_amount: + anyOf: + - type: number + - type: "null" + description: A flat fee charged for this tier, in addition to the per-unit + amount. required: - to - amount - type: "null" description: Tiered pricing for the product item. Not applicable for fixed price items. + tier_behavior: + anyOf: + - enum: + - graduated + - volume + - type: "null" + description: "How tiers are applied: graduated (split across bands) or volume + (flat rate for the matched tier). Defaults + to graduated." usage_model: anyOf: - enum: @@ -7731,7 +9219,7 @@ paths: - customer_id - balance examples: - - &a41 + - &a45 allowed: true customer_id: cus_123 entity_id: null @@ -7758,7 +9246,7 @@ paths: resets_at: 1773851121437 price: null expires_at: null - example: *a41 + example: *a45 x-speakeasy-name-override: check parameters: - name: x-api-version @@ -7837,11 +9325,11 @@ paths: - customer_id title: TrackParams examples: - - &a42 + - &a46 customer_id: cus_123 feature_id: messages value: 1 - example: *a42 + example: *a46 responses: "200": description: OK @@ -7882,7 +9370,7 @@ paths: - value - balance examples: - - &a43 + - &a47 customer_id: cus_123 value: 1 balance: @@ -7907,7 +9395,7 @@ paths: resets_at: 1773851121437 price: null expires_at: null - example: *a43 + example: *a47 x-speakeasy-name-override: track parameters: - name: x-api-version @@ -7992,14 +9480,14 @@ paths: description: Filter events by time range title: EventsListParams examples: - - &a44 + - &a48 customer_id: cus_123 limit: 50 - feature_id: api_calls custom_range: start: 1704067200000 end: 1706745600000 - example: *a44 + example: *a48 responses: "200": description: OK @@ -8058,7 +9546,7 @@ paths: - limit - total examples: - - &a45 + - &a49 list: - id: evt_36xpk2TmuQX5zVPPQ8tCtnR5Weg timestamp: 1765958215459 @@ -8076,7 +9564,7 @@ paths: has_more: false offset: 0 limit: 100 - example: *a45 + example: *a49 x-speakeasy-name-override: list parameters: - name: x-api-version @@ -8178,7 +9666,7 @@ paths: - feature_id title: EventsAggregateParams examples: - - &a46 + - &a50 customer_id: cus_123 feature_id: api_calls range: 30d @@ -8189,7 +9677,7 @@ paths: - messages range: 7d group_by: properties.model - example: *a46 + example: *a50 responses: "200": description: OK @@ -8251,7 +9739,7 @@ paths: - list - total examples: - - &a47 + - &a51 list: - period: 1762905600000 values: @@ -8298,7 +9786,7 @@ paths: sessions: count: 2 sum: 15 - example: *a47 + example: *a51 x-speakeasy-name-override: aggregate parameters: - name: x-api-version @@ -8377,12 +9865,12 @@ paths: - entity_id title: CreateEntityParams examples: - - &a48 + - &a52 customer_id: cus_123 entity_id: seat_42 feature_id: seats name: Seat 42 - example: *a48 + example: *a52 responses: "200": description: OK @@ -8572,7 +10060,7 @@ paths: - purchases - balances examples: - - &a49 + - &a53 id: seat_42 name: Seat 42 customer_id: cus_123 @@ -8617,7 +10105,7 @@ paths: price: null expires_at: null invoices: [] - example: *a49 + example: *a53 x-speakeasy-name-override: create parameters: - name: x-api-version @@ -8682,11 +10170,11 @@ paths: - entity_id title: GetEntityParams examples: - - &a50 + - &a54 entity_id: seat_42 - customer_id: cus_123 entity_id: seat_42 - example: *a50 + example: *a54 responses: "200": description: OK @@ -8876,7 +10364,7 @@ paths: - purchases - balances examples: - - &a51 + - &a55 id: seat_42 name: Seat 42 customer_id: cus_123 @@ -8921,7 +10409,7 @@ paths: price: null expires_at: null invoices: [] - example: *a51 + example: *a55 x-speakeasy-name-override: get parameters: - name: x-api-version @@ -8978,10 +10466,10 @@ paths: - entity_id title: DeleteEntityParams examples: - - &a52 + - &a56 customer_id: cus_123 entity_id: seat_42 - example: *a52 + example: *a56 responses: "200": description: OK @@ -8995,9 +10483,9 @@ paths: required: - success examples: - - &a53 + - &a57 success: true - example: *a53 + example: *a57 x-speakeasy-name-override: delete parameters: - name: x-api-version @@ -9054,10 +10542,10 @@ paths: - program_id title: CreateReferralCodeParams examples: - - &a54 + - &a58 customer_id: cus_123 program_id: prog_123 - example: *a54 + example: *a58 responses: "200": description: OK @@ -9080,11 +10568,11 @@ paths: - customer_id - created_at examples: - - &a55 + - &a59 code: customer_id: created_at: 123 - example: *a55 + example: *a59 x-speakeasy-name-override: createCode parameters: - name: x-api-version @@ -9141,10 +10629,10 @@ paths: - customer_id title: RedeemReferralCodeParams examples: - - &a56 + - &a60 code: REF123 customer_id: cus_456 - example: *a56 + example: *a60 responses: "200": description: OK @@ -9167,11 +10655,11 @@ paths: - customer_id - reward_id examples: - - &a57 + - &a61 id: customer_id: reward_id: - example: *a57 + example: *a61 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 ee60314ab..9e04cfa00 100644 --- a/apps/docs/mintlify/docs.json +++ b/apps/docs/mintlify/docs.json @@ -129,12 +129,14 @@ { "group": "Billing", "pages": [ - "api-reference/billing/billingAttach", + "api-reference/billing/attach", "api-reference/billing/billingUpdate", "api-reference/billing/previewAttach", "api-reference/billing/previewUpdate", "api-reference/billing/openCustomerPortal", - "api-reference/billing/setupPayment" + "api-reference/billing/setupPayment", + "api-reference/billing/previewMultiAttach", + "api-reference/billing/multiAttach" ] }, { diff --git a/apps/docs/package.json b/apps/docs/package.json index 5951a6750..0954080fe 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -3,7 +3,7 @@ "private": true, "scripts": { "pull": "bun scripts/pull.ts", - "dev": "cd mintlify && mint dev --port 3003", + "dev": "cd mintlify && bun x mint dev --port 3003", "build": "cd mintlify && mint build", "start": "cd mintlify && mint dev" }, diff --git a/apps/sdk-test/app/scenarios/core/use-autumn/page.tsx b/apps/sdk-test/app/scenarios/core/use-autumn/page.tsx index c82f5a7e9..ef4da9251 100644 --- a/apps/sdk-test/app/scenarios/core/use-autumn/page.tsx +++ b/apps/sdk-test/app/scenarios/core/use-autumn/page.tsx @@ -2,7 +2,9 @@ import type { ClientAttachParams, + ClientMultiAttachParams, ClientOpenCustomerPortalParams, + ClientSetupPaymentParams, } from "autumn-js/react"; import { useCustomer } from "autumn-js/react"; import { useId, useState } from "react"; @@ -13,7 +15,12 @@ import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; -type ActionTab = "attach" | "check" | "openCustomerPortal"; +type ActionTab = + | "attach" + | "multiAttach" + | "check" + | "setupPayment" + | "openCustomerPortal"; type LastActionState = { name: string; @@ -46,10 +53,18 @@ const toErrorPayload = ({ error }: { error: unknown }) => { }; export default function UseAutumnScenarioPage() { - const { isLoading, error, refetch, attach, check, openCustomerPortal } = - useCustomer({ - errorOnNotFound: false, - }); + const { + isLoading, + error, + refetch, + attach, + multiAttach, + check, + setupPayment, + openCustomerPortal, + } = useCustomer({ + errorOnNotFound: false, + }); const [lastUpdatedAt, setLastUpdatedAt] = useState(null); const [isRunning, setIsRunning] = useState(false); @@ -64,12 +79,18 @@ export default function UseAutumnScenarioPage() { const [requiredBalance, setRequiredBalance] = useState(""); const [openInNewTab, setOpenInNewTab] = useState(false); const [portalReturnUrl, setPortalReturnUrl] = useState(""); + const [multiAttachPlanIds, setMultiAttachPlanIds] = useState(""); + const [setupPaymentSuccessUrl, setSetupPaymentSuccessUrl] = useState(""); + const [setupPaymentPlanId, setSetupPaymentPlanId] = useState(""); // Form element IDs const planIdInputId = useId(); const featureIdInputId = useId(); const requiredBalanceInputId = useId(); const portalReturnUrlInputId = useId(); + const multiAttachPlanIdsInputId = useId(); + const setupPaymentSuccessUrlInputId = useId(); + const setupPaymentPlanIdInputId = useId(); const runAction = async ({ name, @@ -137,6 +158,35 @@ export default function UseAutumnScenarioPage() { }); }; + const handleMultiAttach = () => { + if (!multiAttachPlanIds) return; + const plans = multiAttachPlanIds + .split(",") + .map((id) => ({ planId: id.trim() })); + const params: ClientMultiAttachParams = { + plans, + openInNewTab, + }; + runAction({ + name: "multiAttach", + params, + execute: () => multiAttach(params), + }); + }; + + const handleSetupPayment = () => { + const params: ClientSetupPaymentParams = { + planId: setupPaymentPlanId || undefined, + successUrl: setupPaymentSuccessUrl || undefined, + openInNewTab, + }; + runAction({ + name: "setupPayment", + params, + execute: () => setupPayment(params), + }); + }; + const handleOpenCustomerPortal = () => { const params: ClientOpenCustomerPortalParams = { returnUrl: portalReturnUrl || undefined, @@ -180,6 +230,17 @@ export default function UseAutumnScenarioPage() { > Attach + + + + )} + + {activeTab === "setupPayment" && ( +
+
+ + setSetupPaymentPlanId(e.target.value)} + className="h-8 text-sm" + /> +
+
+ + setSetupPaymentSuccessUrl(e.target.value)} + className="h-8 text-sm" + /> +

+ Defaults to the current page URL when left empty. +

+
+ + +
+ )} + {activeTab === "openCustomerPortal" && (
diff --git a/apps/sdk-test/next.config.ts b/apps/sdk-test/next.config.ts index e9ffa3083..6bb84e63a 100644 --- a/apps/sdk-test/next.config.ts +++ b/apps/sdk-test/next.config.ts @@ -1,7 +1,16 @@ +import path from "node:path"; import type { NextConfig } from "next"; const nextConfig: NextConfig = { - /* config options here */ + transpilePackages: ["autumn-js"], + turbopack: { + resolveAlias: { + "@useautumn/sdk": path.resolve( + import.meta.dirname, + "../../packages/sdk/dist/esm/index.js", + ), + }, + }, }; export default nextConfig; diff --git a/bun.lock b/bun.lock index 923794f96..ed2a8d7dc 100644 --- a/bun.lock +++ b/bun.lock @@ -175,7 +175,6 @@ "version": "1.0.0", "dependencies": { "@autumn/shared": "workspace:*", - "@clickhouse/client": "catalog:", "chalk": "^5.3.0", "dotenv": "^16.5.0", "drizzle-orm": "catalog:", diff --git a/others/python-sdk/.speakeasy/code-samples.overlay.yaml b/others/python-sdk/.speakeasy/code-samples.overlay.yaml index ed4ff7f11..b8281392d 100644 --- a/others/python-sdk/.speakeasy/code-samples.overlay.yaml +++ b/others/python-sdk/.speakeasy/code-samples.overlay.yaml @@ -93,6 +93,37 @@ actions: res = autumn.billing.attach(customer_id="cus_123", plan_id="pro_plan") + # Handle response + print(res) + - target: $["paths"]["/v1/billing.multi_attach"]["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.multi_attach(customer_id="cus_123", plans=[ + { + "plan_id": "pro_plan", + }, + { + "plan_id": "addon_seats", + "feature_quantities": [ + { + "feature_id": "seats", + "quantity": 5, + }, + ], + }, + ], redirect_mode="if_required") + # Handle response print(res) - target: $["paths"]["/v1/billing.open_customer_portal"]["post"] @@ -129,6 +160,37 @@ actions: res = autumn.billing.preview_attach(customer_id="cus_123", plan_id="pro_plan") + # Handle response + print(res) + - target: $["paths"]["/v1/billing.preview_multi_attach"]["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.preview_multi_attach(customer_id="cus_123", plans=[ + { + "plan_id": "pro_plan", + }, + { + "plan_id": "addon_seats", + "feature_quantities": [ + { + "feature_id": "seats", + "quantity": 5, + }, + ], + }, + ], redirect_mode="if_required") + # Handle response print(res) - target: $["paths"]["/v1/billing.preview_update"]["post"] diff --git a/others/python-sdk/.speakeasy/gen.lock b/others/python-sdk/.speakeasy/gen.lock index 07ec6ab0e..bae51eb6c 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: 0c62921ca1a0c4d6c71c953f5ad681fa + docChecksum: 865cfc52c4454d3c740e0f4b43f3986b docVersion: 2.1.0 speakeasyVersion: 1.719.0 generationVersion: 2.824.1 releaseVersion: 0.4.18 - configChecksum: 989b2f834afc1fc7bcfcc2dcf606142f + configChecksum: 41df3bbc5ee3bcb542ee83d784b84485 persistentEdits: - generation_id: 83181845-507a-4547-b45b-e79a21b6dd19 - pristine_commit_hash: 40a9ce5f35193ea0f066b2902dcbfffc1c0739d5 - pristine_tree_hash: 10c18e3015cefd2c57c92542818213117099512e + generation_id: f7b99716-8a52-4227-b40c-afba23bc3941 + pristine_commit_hash: 6386ee69275abf8ccd7a7d09f2cbc7fcfbe3ade4 + pristine_tree_hash: 11d0ae3d10d3a99cd89ad9423690603c8014742c features: python: additionalDependencies: 1.0.0 @@ -67,10 +67,126 @@ trackedFiles: id: b597cfc651ae last_write_checksum: sha1:641c0d27fe8e8242429da6d8083fe10ab70b570c pristine_git_object: 2fd7b5fb0f426ec942cb43aa30d3a85287ef724a + docs/models/attachattachdiscount.md: + id: 1283b5fb2544 + last_write_checksum: sha1:fe32155e714211074643a30f70794924db11d3d7 + pristine_git_object: 4b225a6a18f0583c0a5c0d0f770ef46cd12db337 + docs/models/attachbaseprice.md: + id: 9d6b5ae8c450 + last_write_checksum: sha1:e44507e82138befb60cd7797dc3d4a0e50fd1579 + pristine_git_object: f680f716064012181c133cd1e21fb92b1bfc0b60 + docs/models/attachbillingmethod.md: + id: 99e45152f80b + last_write_checksum: sha1:b8221621e406f78f522156e0fa70d60014ad368e + pristine_git_object: 674a4b1c6077466a9b4d228fe743054b34f21087 + docs/models/attachcode.md: + id: 1d55f798a682 + last_write_checksum: sha1:dd5a0adc97a023eec27540fe9bb590334ebcdcc2 + pristine_git_object: 1a1195e26b91cbb4948aa79005efbc85197c4d1b + docs/models/attachcustomize.md: + id: 46261b03538b + last_write_checksum: sha1:8ae92012b8fc0197f260af1dc249f6bcede5447f + pristine_git_object: a9b36196193134f08ac2334857c3e734b2ad9b99 + docs/models/attachdurationtype.md: + id: 9e410a17d56b + last_write_checksum: sha1:201a2d77508a63c17506d5ba9370d2736a8e2024 + pristine_git_object: d9256b21f869bf4d7fab1915970481f152437e98 + docs/models/attachexpirydurationtype.md: + id: 524cd5ddcdd5 + last_write_checksum: sha1:91fadc6920cc988fe2e0b5b02e56a137a3973396 + pristine_git_object: 96116d8755118d92cc4250d33231226b17e56eb7 + docs/models/attachfeaturequantity.md: + id: 5c9fae37c74a + last_write_checksum: sha1:7447c83e4931c61fa08d0576e7e4390a363b448c + pristine_git_object: 227f8efa68dde2c8cd447ca0efcf2fbf49ebda14 + docs/models/attachfreetrialparams.md: + id: 95ce8866f481 + last_write_checksum: sha1:0cc1ce0c1ee4d8265b9229988b7ab4d372753765 + pristine_git_object: 9119814910ab6dcb1f1fe3cb68d7b2b3ba5708e7 + docs/models/attachglobals.md: + id: 1f2407e8c680 + last_write_checksum: sha1:01adc2f34b6f6da134d5aee7cf79831b95918ea7 + pristine_git_object: 103e8e64817edbc22a4016c8d664eea94ac6bcf7 + docs/models/attachinvoice.md: + id: 9381f0386811 + last_write_checksum: sha1:643a28de3c04177fbdbbc2408ac66d2a21011844 + pristine_git_object: 8263c9b452d2d70eb43f9971c2a6138d03c4fafb + docs/models/attachinvoicemode.md: + id: b01f94714872 + last_write_checksum: sha1:7cd024db5ec907c0d481245dbc7ac89c4f6f3148 + pristine_git_object: 5d7416d60f95d5c4c61f875c61abc909fd861647 + docs/models/attachitempriceinterval.md: + id: da3ed38a03d3 + last_write_checksum: sha1:7dc2a9864c52c09ca9e59ff09f7527345794d372 + pristine_git_object: c49d88c4c7696afe17566afb55b3eacb85bdc1b5 + docs/models/attachondecrease.md: + id: dd7dd5f2b175 + last_write_checksum: sha1:c3d1c6a51c901ed80d02d4449f70ce839bf062fa + pristine_git_object: 2eb0944df8025fc478b80f965b0bda2ec9556c18 + docs/models/attachonincrease.md: + id: 8db7e1552d9b + last_write_checksum: sha1:7b90839a3f71de9a1b928b5cbb973fefdc2e4b21 + pristine_git_object: 0640ae26af1990b129e9d92f1f84c5b93dbe91e4 docs/models/attachparams.md: id: cc19aeb7efcc - last_write_checksum: sha1:ac2d20aa4233eafd4f6bfb25c23c54a4965e26bc - pristine_git_object: a82ed6e68dc6d3c8a0984148a9a0bc18378384e4 + last_write_checksum: sha1:68f8c5cc8325f51455861198f365e96f91446168 + pristine_git_object: bd0185ce4c31d9771de7eff20a486ce7817f6329 + docs/models/attachplanitem.md: + id: 5012fb5dd668 + last_write_checksum: sha1:d99041abdc1966381f9c3be442d82ae8894e35d8 + pristine_git_object: b0c7d55d66c6f3db5395dbebbfe6184f5ad9a820 + docs/models/attachplanschedule.md: + id: 5dedfadc5aa9 + last_write_checksum: sha1:2a3ba63683284a780e3271e87fefa1b5454d6d14 + pristine_git_object: 50e9fb97e031ae1980846b152a3aa8f5d04e0793 + docs/models/attachprice.md: + id: 5ac4c60e2ff1 + last_write_checksum: sha1:ce20a5bbb0abafc24c72e6ed2f9ceacad6679eab + pristine_git_object: 82e6a2748fa31e66759be781b6a8c0cbe60345f6 + docs/models/attachpriceinterval.md: + id: 8f4444fe4a59 + last_write_checksum: sha1:667c436605831e4482ea2ec4d8c1f3412baf3f56 + pristine_git_object: 8dbf9d9e66ad45a3c9b7928ecdc563a6a6f33ac8 + docs/models/attachproration.md: + id: d92b4c3cafc9 + last_write_checksum: sha1:afb0910fbce9bf9150b725ea18333deac67a86a4 + pristine_git_object: e4108282ef057841da4ce7c0b86014b093540c6f + docs/models/attachprorationbehavior.md: + id: 47599392eeb0 + last_write_checksum: sha1:dffce59b18293fa90357642373404b09c5075631 + pristine_git_object: 73d6811a4272a920eaaf4fe92b9b956fcf1e32a8 + docs/models/attachrequiredaction.md: + id: e8ac88409626 + last_write_checksum: sha1:d6e507f9cd1e47e617c13b69ab474f8dacd63c36 + pristine_git_object: 0a54a0d7cd95610e4f7fa5bb3e046557912a08a4 + docs/models/attachreset.md: + id: bd24fed93dad + last_write_checksum: sha1:f9c5aa626c32b2c2476aab6c26dce1e224949776 + pristine_git_object: e406e5ad17a15e88a409c3b1d4715dc367d1c6dd + docs/models/attachresetinterval.md: + id: b66e6fdb0dff + last_write_checksum: sha1:ce7b9746fcc351e855e23a01da8b484d752fe68c + pristine_git_object: d3a411212a7c9a04e791258b5c7b4d5025abbe47 + docs/models/attachresponse.md: + id: 8badce83e7c2 + last_write_checksum: sha1:9b71d935c1dc9f81b2e5f1e8718ba2fe7737e27c + pristine_git_object: b7b54c50c23b5092ac69b9c64b8e449f99417143 + docs/models/attachrollover.md: + id: 09283828a333 + last_write_checksum: sha1:c87860fe97c4a1fc828edac5697899ac32e190c5 + pristine_git_object: f30540cd76f0fcc9a15c1002aa411a1c5fde5986 + docs/models/attachtier.md: + id: 882f4c313cfd + last_write_checksum: sha1:443cf0d9f17d4194947838c2abc165fb373b300d + pristine_git_object: fa957696577589e76c002242d9ef764de645f7ba + docs/models/attachtierbehavior.md: + id: dd4442a54a75 + last_write_checksum: sha1:933eae06cb0235ae6d3c89de2d3ee2ac1d9ea35a + pristine_git_object: 3a306087ef917c5715f0d6c98f54682299662e7d + docs/models/attachto.md: + id: 1b02aab4ff64 + last_write_checksum: sha1:808ce310ce6ff60548951c33b708bd7b5ea9a67d + pristine_git_object: c587e1d58619e53a6fa292207efa0af725df23c4 docs/models/balance.md: id: 9de59403580f last_write_checksum: sha1:7508d93dab982c0c014d93543e870118e63892cd @@ -97,8 +213,8 @@ trackedFiles: pristine_git_object: a65f5523a040e8a83f482d5d4a257b3954615d3d docs/models/balanceprice.md: id: b299e024076f - last_write_checksum: sha1:1cf41eaf903c339950de459c158516329ff813f9 - pristine_git_object: 5b268732b3ccdc11ed890f7ec83dc7004bc6f3ee + last_write_checksum: sha1:e9b384e1b3c171a7fedf6b7ca6c149ebfa63ba39 + pristine_git_object: b975f0a6bc81d0b51e9803f21c6f49850d6cdc1a docs/models/balancereset.md: id: 0fd284048e85 last_write_checksum: sha1:6ff053d7718006bfd359fad8eb961cd4af92257e @@ -109,8 +225,12 @@ trackedFiles: pristine_git_object: 43c658b3efea42752d73bd913e72a865bb7d9125 docs/models/balancetier.md: id: 75837d0d63eb - last_write_checksum: sha1:e3f86819917d0bf0750c232c4f0b58beebddd7dd - pristine_git_object: 3bf48b4818861ae9fa103c96a5f7c9516492ec17 + last_write_checksum: sha1:3ef05cd2778a7ab4d76f1c98fcaa3e062ece5217 + pristine_git_object: 504114757fae694bfa8e9cca6b7e167c5306c677 + docs/models/balancetierbehavior.md: + id: c5d6d94e4c04 + last_write_checksum: sha1:8c6caa64e60d7c93bfaffaa25cb758b61547d75e + pristine_git_object: bdcf40add36d9f3a50497013067d69e50fd30724 docs/models/balanceto.md: id: 7bdf5d7db17f last_write_checksum: sha1:de337b5228e750b4c8ee3da18db8b9c94401277c @@ -119,118 +239,6 @@ trackedFiles: id: 75c2cae544fe last_write_checksum: sha1:421b637d3c78e46253b1c7e2647f6ff87044445c pristine_git_object: 593a752a830a4abd82ce47a483331b88395e9835 - docs/models/billingattachattachdiscount.md: - id: ab8b9ec563c9 - last_write_checksum: sha1:99de328733df97500630d4567c33df50ba5f1da4 - pristine_git_object: ba15eed878817448c760eedd39a66ed08df5cb68 - docs/models/billingattachbaseprice.md: - id: 352af5ec1a3c - last_write_checksum: sha1:5400ae1939418662f2b0d985ae6b539dcfd86755 - pristine_git_object: fb0ee6c9d84a60a6747cef16b45c5c3c19d09d44 - docs/models/billingattachbillingmethod.md: - id: 7ad8ef9b29bf - last_write_checksum: sha1:241dab01905175215909ddd7458ee6213a286b8e - pristine_git_object: 01d5f7eda7084059d7279155a23110ab35090d51 - docs/models/billingattachcode.md: - id: f8bd734cbf81 - last_write_checksum: sha1:596cc379144fb4058cec3dcfdab10e8f944d873d - pristine_git_object: c6c73c53409e6d55025166aad9a579fb2cfb4093 - docs/models/billingattachcustomize.md: - id: f0ed3bf58bf5 - last_write_checksum: sha1:1f9e68411e118a94d73877de2549e11f88363e3d - pristine_git_object: 36485580c7fe43e6824a26c6b3e867900810874d - docs/models/billingattachdurationtype.md: - id: 423b10a9b2e9 - last_write_checksum: sha1:6ca49c53520db8675991ab49ecded773ed0be217 - pristine_git_object: 41bb3014ba0a189dd669fb4e300c14f56b2ac6d7 - docs/models/billingattachexpirydurationtype.md: - id: 24dc4cb9d4b8 - last_write_checksum: sha1:971cdc5c7434d8582e18987465208094578c12ef - pristine_git_object: 101777f7609e305d3df625923c669c2c96343eaa - docs/models/billingattachfeaturequantity.md: - id: d90f6bb025f7 - last_write_checksum: sha1:1a3c2c4993c87abf33d6348cd01dc8d9a73537e7 - pristine_git_object: 3c18ed10847948d84e76a2538c5c8d2ce65f5612 - docs/models/billingattachfreetrialparams.md: - id: 12568af2ae36 - last_write_checksum: sha1:dddc1f2c17eb099d098d48c230088d16c959d207 - pristine_git_object: 28352600b13e5d7f7f4c57d52d471f27c08f528d - docs/models/billingattachglobals.md: - id: 8f8ad3068a94 - last_write_checksum: sha1:2a5da9e7e6545e7b8dcfbf8ace9559e684a0ab6f - pristine_git_object: 66820bcc34ce8a7d6523b86c7e598b494a7f9c62 - docs/models/billingattachinvoice.md: - id: 538000e0b713 - last_write_checksum: sha1:d629fd1a362c898fc5dfc2aee4d0c3d39bcf3c51 - pristine_git_object: b396a7b81d32bc570eac6c442be44d3dace064c5 - docs/models/billingattachinvoicemode.md: - id: 32474930a784 - last_write_checksum: sha1:c5fadc0ff089142669c912629dfbe763fed30392 - pristine_git_object: 51e60356861b229b8e6d06b66c83addc54ad8d67 - docs/models/billingattachitempriceinterval.md: - id: 233d8a371330 - last_write_checksum: sha1:5be75fb2a88e04d5d4fe9b8665eefb5ac5d5881b - pristine_git_object: 4a2673a0ea3b42d3b982d69ed0ed423ee83992b8 - docs/models/billingattachondecrease.md: - id: 27ec2494ba22 - last_write_checksum: sha1:29e11073cd4d07e1d11aafacf4c7c7ddfa178e80 - pristine_git_object: 4c0da568f10c897c33fb91d0817aa9b4251c979c - docs/models/billingattachonincrease.md: - id: c24185dbd0eb - last_write_checksum: sha1:af07f3259f59ec14d71fa18e65aa807f68318244 - pristine_git_object: c62c020f78e93547635c43ac1ba542af04f9a4b0 - docs/models/billingattachplanitem.md: - id: e93a36cbdeef - last_write_checksum: sha1:34dc7f7d9f2ca970ac58d7f8401105ddaa789910 - pristine_git_object: b73b96b937e8473be793a57d4fdcd4c36660eb6b - 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:77e2e873e153b7b8e945db8ceed6824ef3181df5 - pristine_git_object: b6cacb7eb6a1767057de20f1ba9cabb9f3cf1f73 - docs/models/billingattachpriceinterval.md: - id: eaa3d567a6a0 - last_write_checksum: sha1:e69007104b8b17bdd9133bb727201e12188f8a18 - pristine_git_object: a7345fc65589779ec1090bb8cf001a44f403b437 - docs/models/billingattachproration.md: - id: 645f794f4b6f - last_write_checksum: sha1:5d7aa6a47970454040a69df33a5ab2f68aa0a14b - pristine_git_object: 9ac101fd7f3fb5f41d2fa213b3710744cdbc5ab1 - docs/models/billingattachprorationbehavior.md: - id: d2ccb3bd122b - last_write_checksum: sha1:f7c9f71108c1a7806bf1c2e4ac4781f5307a0ddb - pristine_git_object: 3a50440628c1445c1cffa0d80fcf46f2c8578117 - 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:1e6db81a816adaa19bd8c6e376adb35bc28a98ee - pristine_git_object: d127502e3b02901079c92da7031f3a77afc2cb21 - docs/models/billingattachresetinterval.md: - id: c1d7423c3b30 - 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:3cead3b3d2adafd217830980cd62481c518b51c2 - pristine_git_object: 5eb116656b3d57ed4d1f27e879262ef51a0d093d - docs/models/billingattachtier.md: - id: e5fbb17d1129 - last_write_checksum: sha1:8d331efeb9148debb1061d3a03b9899c21123b06 - pristine_git_object: 228d6d1d1488cec6f8f316192bc64a71162e528f - docs/models/billingattachto.md: - id: 85c3b486f689 - last_write_checksum: sha1:a3e1f10fb2bd6d3d279f70a4ee64d8d885d17ed3 - pristine_git_object: 71b0acda81003e7766e3e4401d45dc1247e527f5 docs/models/billingupdatebaseprice.md: id: c632c15479cf last_write_checksum: sha1:f6208715f5d3eea0ffb73dc8bfd4135c9b278255 @@ -297,8 +305,8 @@ trackedFiles: pristine_git_object: a98c45c4f8dd53367fb90be80c9e3bf264690faa docs/models/billingupdateprice.md: id: 818c94761161 - last_write_checksum: sha1:dcec3411a5345e78fd89f15db5ac3f7e5543887b - pristine_git_object: ec45fb0f17e0c343393593c60b11df48859bf0af + last_write_checksum: sha1:364460fb3372880e6c42ce522ca759bb98092f88 + pristine_git_object: b7c4d7f98430c5f6cad62591307b6616aa9e19d2 docs/models/billingupdatepriceinterval.md: id: 35fa4e54bdfa last_write_checksum: sha1:f800390f9ff92064f4cfd8a7a9e1a974e9735ae7 @@ -333,8 +341,12 @@ trackedFiles: pristine_git_object: 5db81290374474c0b4d832010ba6d88194a72cbb docs/models/billingupdatetier.md: id: b3760261ba4e - last_write_checksum: sha1:e2342a3d3b415a6be05d426f996863b583105d26 - pristine_git_object: 741a7f3e52c38afc8c6666847474bf20cf1ca01f + last_write_checksum: sha1:69d877ae20d8bb9aec5c8e7ec0042bcbf2f7b05b + pristine_git_object: a402c21f4dd35892d15958f2346fed02098f4019 + docs/models/billingupdatetierbehavior.md: + id: e232f14f3859 + last_write_checksum: sha1:e04c169893bec388a599fff7e60d82dbde0ff633 + pristine_git_object: 70caee9bb271631dfca70f5a09d91c4981249b85 docs/models/billingupdateto.md: id: 2dbc89773256 last_write_checksum: sha1:ac60ad0fd88dab5a347f21563cad039fdf8719c4 @@ -369,8 +381,8 @@ trackedFiles: pristine_git_object: 188519a4cdc6cc4b616dbc0f4dc4c7284bd8a6d4 docs/models/checkitem.md: id: 17b1916ed078 - last_write_checksum: sha1:1ea15113a8b74ad343ae5ab7c3000d56332f10cf - pristine_git_object: b07508da6a689d3dcef31b019aebfa018bfdd109 + last_write_checksum: sha1:91c1009c0ee31e4e1377b09b003a3a3e4380a933 + pristine_git_object: 2d6ca99d1816e935b2bde0dc5a834d7cd51b763c docs/models/checkondecrease.md: id: 2c49735aaa4e last_write_checksum: sha1:957ef5f0c483f390fab1bd6bb9ad1f21697d1898 @@ -395,6 +407,14 @@ 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/checktierbehavior.md: + id: 9617428cc802 + last_write_checksum: sha1:fa41c52ec15e0f7cb7d859c0fa26112ed11f5e91 + pristine_git_object: 07d0ee6f485f4056f4e301174ad0e7a37143e032 docs/models/checkto.md: id: dc4a2ec3784d last_write_checksum: sha1:d1b57ef2c9b13fcd684b22a9d7096f9aed82d60d @@ -507,6 +527,10 @@ trackedFiles: id: bda39f39fac9 last_write_checksum: sha1:8d3bf3dfd849ce3112674c8108d75e77bbf40d92 pristine_git_object: 77081dec474b563f70a69c44edcf5b6eddc6b342 + docs/models/createplancustomereligibility.md: + id: d8ee16f20824 + last_write_checksum: sha1:949fe384e85aa2425fb6dfdfe4df8dbca6cc4f79 + pristine_git_object: 539c0374dfe8eda70b05799972592eb51e53b25b docs/models/createplandurationtyperequest.md: id: e21beb31d05d last_write_checksum: sha1:60840dd5ae3e89cfaa4c6ea23e8e5a604558a533 @@ -557,12 +581,12 @@ trackedFiles: pristine_git_object: 5ab2ea0a0a614abf498ef68a3365d1c64ac01613 docs/models/createplanitempricerequest.md: id: baaf8916c3b6 - last_write_checksum: sha1:ae5604ddf20d7cc5a2faa0b110aea7b7471c983f - pristine_git_object: 4f4033dae1a261fa3e2b98b59ffe8e083b7b27aa + last_write_checksum: sha1:e890f31971faa21234ee36b1836fa3aaab940e1e + pristine_git_object: 14d04aa109c97590e88512b0c61bdc9590bb447d docs/models/createplanitempriceresponse.md: id: 569ccfab75df - last_write_checksum: sha1:17b2fa9f796d384d74dfd79e8346179185f5565e - pristine_git_object: 246e93d3de3b93781af4978209f9c69020ef704f + last_write_checksum: sha1:12fd381cdfbca8c74884cacd4ede2dd072f92505 + pristine_git_object: 19fef177c7353a66f1fc40bfa48b0eb3e68262e8 docs/models/createplanondecrease.md: id: 13e92221faaf last_write_checksum: sha1:c384c642ec8b7025a2e0fc74166e2153e417c173 @@ -625,8 +649,8 @@ trackedFiles: pristine_git_object: a2f64fdb4fadf6e25741034efbaa74019f88d566 docs/models/createplanresponse.md: id: 72de4e2745bb - last_write_checksum: sha1:581f6312ac67fa035583f1c2638c280b26b00646 - pristine_git_object: 3d651e8e0af0ce0ff17bc85124b08ed6aa629b63 + last_write_checksum: sha1:2cbb509b694c60f50163717015a2701b0a6da1ae + pristine_git_object: 7048caf952b0860b68dbc3922353483c63e718d5 docs/models/createplanrolloverrequest.md: id: 01b2ca1d23fb last_write_checksum: sha1:07c7b6cdddd4661ac8aabd4fa76801fd4892e11e @@ -635,14 +659,26 @@ trackedFiles: id: e8134e24a5a8 last_write_checksum: sha1:db70d2fab44add601f2fa16a54f10259274a8dd9 pristine_git_object: 1036a2ba0f28e32f48985255aecfa3bb52a0f679 + docs/models/createplanscenario.md: + id: d4a52c4b83c2 + last_write_checksum: sha1:7a6b8670631a65c5a125651bd8535f865f058cc4 + pristine_git_object: 2853d5d146312fec4aa3d1ea24f3b372b07fd7f5 + docs/models/createplantierbehaviorrequest.md: + id: 2a8236046547 + last_write_checksum: sha1:8d6231303c39b89b6e22523bc59f340c51762a5d + pristine_git_object: ed54766809f122caf3b59dd08c1f424856dfcdbf + docs/models/createplantierbehaviorresponse.md: + id: 491d2246191a + last_write_checksum: sha1:b193b869eaf1688500ecaafcd2bedd1bde2aebf9 + pristine_git_object: 7f8c20b4309c3e5c3169f8da82b30d7f6303ad9a docs/models/createplantierrequest.md: id: d21135e817df - last_write_checksum: sha1:efa6916e59ccfdc88ddadf70f4a6d88a4a52b179 - pristine_git_object: ed4bff7342418dd765a866de7538f0b0cc014c33 + last_write_checksum: sha1:fb9deb2a4f679895a935b64b25bd5e0a6dde4d6c + pristine_git_object: 4e7aff14acf34dd742416e23c8e8614bf3e53037 docs/models/createplantierresponse.md: id: ff3bdb303669 - last_write_checksum: sha1:9dabc7daf612eb7edd182042440c5df931625ac1 - pristine_git_object: ce4d81c7e579f7bb7e84c4cdcf0f7f1ccf74f156 + last_write_checksum: sha1:100a3e0de9c3524796d981dd88e73d6bb33556ff + pristine_git_object: 10797700beaa50a0da0fd870c51b525aea2c42e1 docs/models/createplantorequest.md: id: 0da1b6839035 last_write_checksum: sha1:0c2f734156145d11703794cbeabba0ff908c4333 @@ -679,6 +715,10 @@ trackedFiles: id: dc88db3adc93 last_write_checksum: sha1:42f7f4090ec893457e1f58865a7499a419dfcf4c pristine_git_object: 8816de7792fb2034f720195e14f1324cbe0e67ad + docs/models/customereligibility.md: + id: 6ad6cc047223 + last_write_checksum: sha1:402ddd1dbdcd233d807766948aa2f199a65ff895 + pristine_git_object: dead7788e0918c3af6dd38c1ab719d14ad40226b docs/models/customerenv.md: id: 714d5f271769 last_write_checksum: sha1:0339c99475930033694fa4b6d63c9d0266596379 @@ -851,6 +891,10 @@ trackedFiles: id: f70b7a9fd404 last_write_checksum: sha1:1ad49c99400c9f9c735bf18686e2c7f3a0715803 pristine_git_object: 1f3b4e20a81e527e25e2a9ee59df270faa84504f + docs/models/getplancustomereligibility.md: + id: b80f01a062f6 + last_write_checksum: sha1:018b53eec173a602d62309d8e26c356c64a0fdfd + pristine_git_object: 44ee3e7e2f4682afbb378332055b204820b87fe7 docs/models/getplandurationtype.md: id: 531b497ea20b last_write_checksum: sha1:df5c7a55a41ba415e20ad5380cec7bfc25ac29ac @@ -889,8 +933,8 @@ trackedFiles: pristine_git_object: 6728190d3751f3fccc8e31d333b11846d5f6e489 docs/models/getplanitemprice.md: id: 1003fb6321bc - last_write_checksum: sha1:4ff69a5edf9fde75592208a3808564d44ca6c57b - pristine_git_object: 254d6ea5d5d414a8fbcff93813b9f4f226ace68d + last_write_checksum: sha1:76992a6d6b84bcaafa18b31cf629d2d340b920c1 + pristine_git_object: 0c83c64deb665b55c1cb0e6e3071ffbdccd20c85 docs/models/getplanparams.md: id: 8196ff0c01c2 last_write_checksum: sha1:e34b05d0e8edb4161d4a0fd1b3db44da16ce739c @@ -921,16 +965,24 @@ trackedFiles: pristine_git_object: f89ea0c6427dda0e3791eeba61089a4bb4f2a3d6 docs/models/getplanresponse.md: id: 2b0a620fdbb6 - last_write_checksum: sha1:ab28211dcdcb7a81a29de258950533a965fbfb88 - pristine_git_object: dfb53b24df9909e36f22d356df255d5e6833c066 + last_write_checksum: sha1:b3bc1ce22f83a8b78e3bcbd75e364c5615974584 + pristine_git_object: fa70cd1a06598e2ae686a0b00c23021085cf8157 docs/models/getplanrollover.md: id: aa86ef4ae999 last_write_checksum: sha1:1efa4540b76a45e1fba1711618405c9627e57a56 pristine_git_object: d6778e26ece0dd751384156f2417e3a87b435f7b + docs/models/getplanscenario.md: + id: c0180a8bc47d + last_write_checksum: sha1:e3449e7c0dfa42e79b2cdf977fa38308be865688 + pristine_git_object: eabd6fbec05948cff00485f737069dac87ef5869 docs/models/getplantier.md: id: 25c80d2e311a - last_write_checksum: sha1:a305e103382fb25f143faecd407b0cde60b5fce9 - pristine_git_object: bf914d4d767d05441d7416cad9014bee873f6287 + last_write_checksum: sha1:dbe6ca30ee8f40b61e781e8f70c5fe7fd2e10229 + pristine_git_object: 102f29514521f351bf99ca62b258d517b02669aa + docs/models/getplantierbehavior.md: + id: 43d70b082849 + last_write_checksum: sha1:8d33409091d654dfbe7d0cdb495289b363e3da7f + pristine_git_object: 74bac9d492b97f798091959496f6301daf1b8fe7 docs/models/getplanto.md: id: 4370b94fa94c last_write_checksum: sha1:8a6c9aa8e0f1b550e9d075188dac724bf555adc3 @@ -1055,6 +1107,10 @@ trackedFiles: id: 8f4524699ea8 last_write_checksum: sha1:8264d803e53a657b5077baf27f79e86b9aca6c1d pristine_git_object: b956d783f8935b18cea46b9c4fde2329141cbf96 + docs/models/listplanscustomereligibility.md: + id: 2d31088f1152 + last_write_checksum: sha1:248a52c05c1b3e8fb33301f6bc01ac6bf5d49669 + pristine_git_object: 76789c2297d6b32109fbb47cc108bfada9547514 docs/models/listplansdurationtype.md: id: 9495db2c46d7 last_write_checksum: sha1:0d6fd83d4998c2a27143e76d4b1b4126e4038822 @@ -1093,12 +1149,12 @@ trackedFiles: pristine_git_object: fed159e8337df81138a81885b73bc60eb9b2268a docs/models/listplansitemprice.md: id: afd054e4c901 - last_write_checksum: sha1:3ff0e385d84092f66817f4edac5d9bf4da444124 - pristine_git_object: 844908867174e1001b0f3501987546109eec6bac + last_write_checksum: sha1:d3ccdeeee4ef516942a626b16ea918fe3649b2e1 + pristine_git_object: e2405c176ca17250f533bad0c44e04afa4eb40a7 docs/models/listplanslist.md: id: 6e9f463afde9 - last_write_checksum: sha1:6695cc81a5ac26ee900bb3486145aaa327e463a2 - pristine_git_object: 40d160c5177b014dad186e2dc3fb52bf249d6225 + last_write_checksum: sha1:3ab59a7b8cfe0aefce5990df247f1ec9b13611aa + pristine_git_object: 5fb65f58778c5a3604b3a88e7d1a0fe59650d903 docs/models/listplansparams.md: id: 585ca32cddb9 last_write_checksum: sha1:ea218ec174d08b0a4ce981e60dbc40f311e0fc43 @@ -1135,10 +1191,18 @@ trackedFiles: id: 82ea7a9e4345 last_write_checksum: sha1:38eab435cc89ad8b2d2877e6bc83d26b11cbfffe pristine_git_object: b1465a838739806bf638ee8507880d90d397724b + docs/models/listplansscenario.md: + id: 76eabad0f48c + last_write_checksum: sha1:d2705eaef3de141431461f9220531afa8bd5acd3 + pristine_git_object: 478bdd6a010f8b653887cb8c8a434e998e7f4302 docs/models/listplanstier.md: id: 349f4154ddda - last_write_checksum: sha1:81d42f38df41ee6b337de06ced2a4461ef6b5936 - pristine_git_object: 01472ab682d460e78f51d7e759a98b767e6fc88f + last_write_checksum: sha1:9df26b88ceb2786944643ab24205577eb8544b3b + pristine_git_object: f54eb658ec91fa0b7a5cf9dc2a431308c6c46584 + docs/models/listplanstierbehavior.md: + id: f910370a1711 + last_write_checksum: sha1:cc7e6216d011b75eebfa959dd7a4c88422c9eae8 + pristine_git_object: 50649d135c09691831f63fe930cbd678240512a1 docs/models/listplansto.md: id: f5c4d5fd869e last_write_checksum: sha1:8bbc02c32db22255d8cc9b70f3e0a809ea5e1553 @@ -1147,6 +1211,130 @@ trackedFiles: id: c265fc1d3752 last_write_checksum: sha1:fee41af7544896b624de7a39fd20dadcf73d8dad pristine_git_object: f5cdaa931dfd1225fc6e7e45b4c7df54934a462d + docs/models/multiattachattachdiscount.md: + id: 84b9e0a4d680 + last_write_checksum: sha1:7f6655964faa1676f26c26520d23e42cd2eb8af6 + pristine_git_object: d32eacf14453b49c129dab221e797de4adba61c3 + docs/models/multiattachbaseprice.md: + id: 0c418763c522 + last_write_checksum: sha1:7788554f5409cb60dbea0f83cdf8d55df10eb36d + pristine_git_object: 290b9413b26177294f70e9beaadedcc9981cf6dc + docs/models/multiattachbillingmethod.md: + id: 78bd00e832a8 + last_write_checksum: sha1:6b3e4bd84e01d8e880a8be15caa90484840cf064 + pristine_git_object: f7af35a930bb6948739c84aaa55b6793fd4056fd + docs/models/multiattachcode.md: + id: f423dbc408f7 + last_write_checksum: sha1:f0a120e4cd18acd40974c037f768ce9e73b79fc3 + pristine_git_object: 47ba65d1e0c495fedda0f6d28fb79aaea9f89a3f + docs/models/multiattachcustomize.md: + id: 5f3ca0c4e8cd + last_write_checksum: sha1:45fd9bec1e1233c2c7ae11ccc4fae5619dd06ec1 + pristine_git_object: 295b2878cf8db291260aaac31fa5535b10661a27 + docs/models/multiattachdurationtype.md: + id: f5a45a0c8df0 + last_write_checksum: sha1:0ac6362a2845051fff61ed4e77f7d711c689f575 + pristine_git_object: e81aa4ad0a612e36071ce045ca46d84b6d3dfc84 + docs/models/multiattachentitydata.md: + id: 59bc1e3bc662 + last_write_checksum: sha1:c55ff1c7dc4d0267823a947977cef1dbdd276e59 + pristine_git_object: 6fa33d9500cbe46e57dfda16e47122bf2faac654 + docs/models/multiattachexpirydurationtype.md: + id: 5515efd998cf + last_write_checksum: sha1:9d197dfe50cd37d043f9416f80072fa479053528 + pristine_git_object: 1a4762ca683493ac539f74fa6f1809c2aa121bd5 + docs/models/multiattachfeaturequantity.md: + id: 41d1fc07ea2b + last_write_checksum: sha1:4e17966501c6555f7b28de4bdaf6e0a8d30d877b + pristine_git_object: a487f53dcf24f534ee419eb83acdce1a94958441 + docs/models/multiattachfreetrialparams.md: + id: 55ea150e1844 + last_write_checksum: sha1:1d33665b364e93ad2a24f0686facefe492ee0f67 + pristine_git_object: 8198729d5e91afb6d28ee669279e2f8f6f9e63a5 + docs/models/multiattachglobals.md: + id: 1ef527f17694 + last_write_checksum: sha1:3290dc20ea38a6f807bf6e6da4c7760a6413e04c + pristine_git_object: 7575de26ee8fa9e31549e792b89a4ccf0ed1e909 + docs/models/multiattachinvoice.md: + id: f382dae16ae0 + last_write_checksum: sha1:99bdaad349d657fd24fb7360dbaaff20be23c09e + pristine_git_object: 4c4123fdbe2fd21dc4c0c6a92e8f1b2bb9352640 + docs/models/multiattachinvoicemode.md: + id: ee3e6021f815 + last_write_checksum: sha1:98745fe9a1792f42f39986e88a2a1cb29777e0d9 + pristine_git_object: ffc930cdd73dafe972deb77b4b8090cdee001cdb + docs/models/multiattachitempriceinterval.md: + id: 0030b6692fe1 + last_write_checksum: sha1:02e35cabef42fcd6e113495f3b860ce35eb572ea + pristine_git_object: 046a3f693366599cccd226ec67465e4de00077ee + docs/models/multiattachondecrease.md: + id: eb882098e74f + last_write_checksum: sha1:1825b557a75a40639c1b329d849a5ee50d0448c7 + pristine_git_object: 5dd8abe5f6fab10dd5b5fd0e1219c277fd52f49c + docs/models/multiattachonincrease.md: + id: 2645fe9f0f62 + last_write_checksum: sha1:feaa98c20154520deefe1c89929f33b6365670c3 + pristine_git_object: ed7d58da3b22ac78c0a451435246bb87175e0c0b + docs/models/multiattachparams.md: + id: afacc821df4d + last_write_checksum: sha1:ecc7a7de5997f0045534a255e263ac2a1d8e72d2 + pristine_git_object: c6820c5449a69d6f1f8564649b400204456fb7ed + docs/models/multiattachplan.md: + id: f34665db19bc + last_write_checksum: sha1:52082ade80fa1b44a88f4b9ce3d430f1ac92e063 + pristine_git_object: 75018f468ff18148d3ef2fe045fd2f42d1a5d866 + docs/models/multiattachplanitem.md: + id: 2f243f5340cd + last_write_checksum: sha1:a18d43735367e766bc9bfed27a8c7517a18f2aca + pristine_git_object: e494280b32fed45a642f2f11d135a6da8461d71f + docs/models/multiattachprice.md: + id: d4670fd30848 + last_write_checksum: sha1:99a909160bcfb0b16835ca5824969855fe05d2b2 + pristine_git_object: f5035ac6fda1d63df18f9a22fdd0f565e9778627 + docs/models/multiattachpriceinterval.md: + id: 58fbae5e506d + last_write_checksum: sha1:525bb8214350d1f4f120a381b8a36b32a3a3698a + pristine_git_object: 7bb54d92dd1dc404dccd12e692d2aa4c13c72290 + docs/models/multiattachproration.md: + id: a4ccd95a4f1f + last_write_checksum: sha1:644594ce2e14ce35546f83ae9e185a066b359294 + pristine_git_object: bdd561e1f8db63ed4a65fb25ac0bc8514ba94ecd + docs/models/multiattachredirectmode.md: + id: 6898b471cd23 + last_write_checksum: sha1:2e43963cb0c8ea821f8a78e1b030a68997bc0ff6 + pristine_git_object: 5012c8235c34d8d36b80a929ea9bd0ee4137896f + docs/models/multiattachrequiredaction.md: + id: d0c8ce104e28 + last_write_checksum: sha1:b39367dbf7750b87fc30c1b5f90dc6a2ce5bd1cf + pristine_git_object: 7d47f1eeb5ebce971a30a125ddecd6686b069b82 + docs/models/multiattachreset.md: + id: c04afa014184 + last_write_checksum: sha1:272eebcc6adfee1b0e8ecd29088cc280b981e84c + pristine_git_object: d10f501c27db623587ad477725f490326dd130ab + docs/models/multiattachresetinterval.md: + id: bc4b71af1ebb + last_write_checksum: sha1:cafeb533593f4635c3f18c941c88d6c9b884e6c8 + pristine_git_object: 34e299ea1a1a314bb95fc779778788fdebdd2eff + docs/models/multiattachresponse.md: + id: d919bee4ec6b + last_write_checksum: sha1:7095fc0913192166bc2787e44664fa2cb48b038f + pristine_git_object: 6de1cc4bb3cae6f52068df68a54483ebe3034a84 + docs/models/multiattachrollover.md: + id: 9c10829ecaef + last_write_checksum: sha1:47f976670a1d9d856b23f272ebb79f625a541e88 + pristine_git_object: 35c8577d4c417a10b73ab0febf7c78e815bfd11d + docs/models/multiattachtier.md: + id: 8ffc11d3087a + last_write_checksum: sha1:adc2b7fc8114c0450eb8028e61c1f121feac52f6 + pristine_git_object: f52029ae4eaf929f45cf4f2c4f07d8723a560051 + docs/models/multiattachtierbehavior.md: + id: f61b0b7ebb2b + last_write_checksum: sha1:360f87ccc7ab2f4d2190eed9159b43042fa22bf1 + pristine_git_object: a769fda3c10b70124aee1268b896486b4a05cc47 + docs/models/multiattachto.md: + id: 056e50c9e976 + last_write_checksum: sha1:654078650712620389db0a568669db36597a309e + pristine_git_object: 9a835b9ec832a90edf8b764f3deb58c76b310992 docs/models/opencustomerportalglobals.md: id: 9672e1095d8f last_write_checksum: sha1:128710c47318a46258c878691506ae599d1b55e3 @@ -1161,8 +1349,8 @@ trackedFiles: pristine_git_object: e837aa4e197e0d89a5af163eb58863349124e4de docs/models/plan.md: id: 900c4149ef4b - last_write_checksum: sha1:068e0c9b7aac6a13a6c7f32998676003732329a1 - pristine_git_object: eff391298bf05283aefbff6562e18e8a6295c4e3 + last_write_checksum: sha1:6098a0a6bb1c128694303fe27ad5b93dd9cab08a + pristine_git_object: daea8b231352c8ae8fc3d23ab739ed3ce60df632 docs/models/planbillingmethod.md: id: ac90cee4f6c5 last_write_checksum: sha1:30a815d6adf61aea6127d9edb4026936d13a4250 @@ -1193,8 +1381,8 @@ trackedFiles: pristine_git_object: aed40400dc4b6c589ef8673f84dba763aa7588b6 docs/models/planitemprice.md: id: edd9119a1319 - last_write_checksum: sha1:61e15369327937c6e43110b90e81ee15f3a48f5a - pristine_git_object: ed5a320d62544934f6e70586dac5e21dded3f558 + last_write_checksum: sha1:004313fd7f7c8b638c04520720ca697bfc99b5fa + pristine_git_object: 0578ca15e111a177b84a4f162294644d59da4236 docs/models/planprice.md: id: 70699ad0c942 last_write_checksum: sha1:c883ecfef57751ded74a650fd1fc91bf9d87ed4c @@ -1225,8 +1413,12 @@ trackedFiles: pristine_git_object: b24a347af2dd3725b201c0228c293c07296ad436 docs/models/plantier.md: id: 6c3492fd8bbf - last_write_checksum: sha1:b157b295184794131b0a9764e7a82dc518602e9b - pristine_git_object: 139f62e12ba0dd833daecb48fca92e5f008dbb44 + last_write_checksum: sha1:3ac04e6a257a8737265fb4856b77038ffbf54bf6 + pristine_git_object: 303145450d88520e9fb9f08cbf8a27c464e135ca + docs/models/plantierbehavior.md: + id: eef000779cfa + last_write_checksum: sha1:c0c1ce53d480992c255681103b9a3f8233b189ff + pristine_git_object: 563c3a51a6c8f347a65899fefcfca11d43139da7 docs/models/planto.md: id: 642e67b335e5 last_write_checksum: sha1:699b39d870e41c1926ca1f043c3273b00c8b80c0 @@ -1237,8 +1429,8 @@ trackedFiles: pristine_git_object: cf233509e8cc1599a589dba1e68dda9e2d16400b docs/models/preview.md: id: ca71b601ef12 - last_write_checksum: sha1:40aa929c88e329add6e7ca46d7a8a2035a292320 - pristine_git_object: 30f2fde544d6369ffb95e242d86285de93ba6877 + last_write_checksum: sha1:7f28aa6fa61d2909afea263220c1db6760e36683 + pristine_git_object: f1c2dbfbebc8e6e6637734d03a7c2afbde7f8c39 docs/models/previewattachattachdiscount.md: id: a1bb4d726785 last_write_checksum: sha1:09171167e4f41a512c1ddeea51aaa4a8209f9b15 @@ -1305,8 +1497,8 @@ trackedFiles: pristine_git_object: 2fe65b7ad59a16fa648125ced2c2926f5ecbb8b9 docs/models/previewattachparams.md: id: 3ba40d589e3d - last_write_checksum: sha1:9abcbd9d2c12dada8d51a66202060a4f6c2678ef - pristine_git_object: 8da10f10413a75619190a1901405a78a82ec5b55 + last_write_checksum: sha1:daab006d4e62eaae97a5ba69859a4f1c4cf6092f + pristine_git_object: 0c753ec5f8a63f7549029dec729e23622240835a docs/models/previewattachplanitem.md: id: db3480cfb03c last_write_checksum: sha1:f53174ffd7c56ee9e3b7c06a1c17b30ed8fd362e @@ -1317,8 +1509,8 @@ trackedFiles: pristine_git_object: 7551150c582828b16198182257edd1605998c2b7 docs/models/previewattachprice.md: id: caa899534556 - last_write_checksum: sha1:f26ec03fdd9220672d95fcf925140e45abc83f00 - pristine_git_object: 4eace3113fc7582dad5f2f7371024d4f3648c7c2 + last_write_checksum: sha1:5c7bd82d2e4fe15f72769b958b47fa3ae78363d3 + pristine_git_object: e3251f374a50de887dd74b891d22d21deba9ee5a docs/models/previewattachpriceinterval.md: id: 922bda88e1d8 last_write_checksum: sha1:8e38cdd00dd58a77eb13cb133c4f5b31d865659e @@ -1349,12 +1541,140 @@ trackedFiles: pristine_git_object: cdde9832cc438216f32f4525f91aea00eabf0935 docs/models/previewattachtier.md: id: 00f2ee21bab6 - last_write_checksum: sha1:7e0040a68f65874b1590c0d2a7970904962cf86a - pristine_git_object: 014eb11094176ff7a0cba5a008601bcf71241c82 + last_write_checksum: sha1:a0d079e52f7eb69d8f15899ee46cfa65914eebd9 + pristine_git_object: aec41f5a89b5d31916c3ed329522966308aa6cbc + docs/models/previewattachtierbehavior.md: + id: 115ad37af215 + last_write_checksum: sha1:718d895201d280573f54d2c4e1d0d913bec08399 + pristine_git_object: 997335a91b67a1088b21bd08dfd8086d5ac77d04 docs/models/previewattachto.md: id: 6eea2cad63db last_write_checksum: sha1:f942419300ba675c7fe00f0675f5af3dab8e0eba pristine_git_object: 90c95d6ef72958ecea08dce511385caca0711e01 + docs/models/previewmultiattachattachdiscount.md: + id: 1f1c982cd794 + last_write_checksum: sha1:8a065bce1131e0282d2a5a4de536de803b7debb0 + pristine_git_object: a00e9c48453c3331c8893589a9378f6fc1f626c6 + docs/models/previewmultiattachbaseprice.md: + id: a9919f7b4d59 + last_write_checksum: sha1:23ccdbd2c036edab004771f8a47e17e4cf7ce87b + pristine_git_object: 2562b1f2a43232ca2e683c75865c8c3dfd160e50 + docs/models/previewmultiattachbillingmethod.md: + id: c92637a0950c + last_write_checksum: sha1:b3b600448b1f704d40dab1df259d606c3e44ab5e + pristine_git_object: 8bb4488808e3af817c5331cebfd0fbc66fbc4323 + docs/models/previewmultiattachcustomize.md: + id: e2e0b7d3e939 + last_write_checksum: sha1:31e8437aa83882d1f206b0203cdf25a7b37932f1 + pristine_git_object: 1bd18e7bfd1414cf81b45b923573b5abab793b18 + docs/models/previewmultiattachdiscount.md: + id: da5315782323 + last_write_checksum: sha1:1b788a3d1c609cb139ddf3a2c389c018385bb02c + pristine_git_object: 36606b8b85aa4299819a8ee929d1b3ef612bc10b + docs/models/previewmultiattachdurationtype.md: + id: 6cc4db1fee39 + last_write_checksum: sha1:f54782456671576c1838d7ce7da24792d364d867 + pristine_git_object: bb524f83d18fc034a1d880967f6527e5be51ab41 + docs/models/previewmultiattachentitydata.md: + id: 1ff14291b34a + last_write_checksum: sha1:3a5592020e28a7957984a4002e8373582c0c29af + pristine_git_object: 85305751cab65b1412ec7b8c39522e02cb8f3156 + docs/models/previewmultiattachexpirydurationtype.md: + id: 44455bd096b8 + last_write_checksum: sha1:02af32c341d9fcfe16d35330de4e3088afe095b6 + pristine_git_object: 6be2390f331c2386a20edaa9bfb1eb18c93e998d + docs/models/previewmultiattachfeaturequantity.md: + id: 94a97c384125 + last_write_checksum: sha1:06dbfdd1644beb5613e19ca9e3fd5a383cc2d1d3 + pristine_git_object: eb4fed47db55cfe9c0aba74a7aaa1c96ff803ca3 + docs/models/previewmultiattachfreetrialparams.md: + id: 784eef5ce253 + last_write_checksum: sha1:3965d49ac21ea4c59455be2aed5708d38a316e8f + pristine_git_object: dcba92af25dc043c802ce8bfc726c6f8b7586a8e + docs/models/previewmultiattachglobals.md: + id: 70ee106303cc + last_write_checksum: sha1:21ac87ac627bbccd1fde20b3d9f29d588f9851b8 + pristine_git_object: 74932d096dad7119db816c3ce9b93c75a64dcf0b + docs/models/previewmultiattachinvoicemode.md: + id: 54ae12af9cfe + last_write_checksum: sha1:bc0d0e512c3643cfb05d0ee952fc4f10a06e02f8 + pristine_git_object: 516159a7040694c7888368e96a319b35ebd29887 + docs/models/previewmultiattachitempriceinterval.md: + id: 8ca44d192cbe + last_write_checksum: sha1:a0d06f55cc6f7cbbe7be3c0154ecd36aa8281e2e + pristine_git_object: bc25b0798e2a53349a757957a31bc42b7ffca927 + docs/models/previewmultiattachlineitem.md: + id: 372c4f319256 + last_write_checksum: sha1:60c3520d7f73a608e1ae7cb343ec4a42db112286 + pristine_git_object: 18dd5a96a55a92acbce3e002c8ce2d57200442a9 + docs/models/previewmultiattachnextcycle.md: + id: 5e370fab1e3c + last_write_checksum: sha1:7ece567cb456b2e612eacf46a1df88151e9da9a7 + pristine_git_object: 9a60e68846cf413dcd99d6930ae6aa70321dfec8 + docs/models/previewmultiattachondecrease.md: + id: 21532d46903d + last_write_checksum: sha1:4b591c017da9bcf618d7334146a826ec658da677 + pristine_git_object: afd67f7d33a2b32a6722dc13aaea972a1657693f + docs/models/previewmultiattachonincrease.md: + id: 49df4f246e99 + last_write_checksum: sha1:da305ad824c752a1c618eb8053ae955d3890bd28 + pristine_git_object: b13c6cba97d2aea223ed63097abbd628467c1b97 + docs/models/previewmultiattachparams.md: + id: 1d4632c5e286 + last_write_checksum: sha1:a2080581206c1203696e4665022364ca913a68ea + pristine_git_object: 04d8985f79e056ccd60959c2c5e848654201a670 + docs/models/previewmultiattachplan.md: + id: 9990b75aaf40 + last_write_checksum: sha1:1b4a05820811ba66546dbdd04b48b746a2ff2bb7 + pristine_git_object: 915739720d5aaa95d314a1c32f13ca0c4d4df0b8 + docs/models/previewmultiattachplanitem.md: + id: ff6c80dcedee + last_write_checksum: sha1:ea6894ab3c0cdc0bad0d46e02b19b545bfea695e + pristine_git_object: dc590613d56850027ff04b4b74beb95f3700c965 + docs/models/previewmultiattachprice.md: + id: 368b3f70488a + last_write_checksum: sha1:05d632a1779f729991741d6dc5cb0b5c8121cd0d + pristine_git_object: 3e020fd0292ca357afe2fc1639370799b060c530 + docs/models/previewmultiattachpriceinterval.md: + id: 2b2601649b6d + last_write_checksum: sha1:bf76a503f0cfbbfe4f0ca3baf62307ce38ee766a + pristine_git_object: 84dc91145b0cf810dc6f3508d439746eda6a3f55 + docs/models/previewmultiattachproration.md: + id: a3b6b1d2d9fb + last_write_checksum: sha1:affa177d9b1b98eeadb94b3acbcc519dc46c4c01 + pristine_git_object: 0a96249ff6158b25f29c66e7fd321fc0ed9a3251 + docs/models/previewmultiattachredirectmode.md: + id: 3190f18130dc + last_write_checksum: sha1:a342d6a1157e69b06e071933038bc018295ec72c + pristine_git_object: 57584818b587fe4012cc335c2271bf30d2d7baaa + docs/models/previewmultiattachreset.md: + id: 38ec56a354c4 + last_write_checksum: sha1:6227feb0bf39f70a8bef3be1ce0ee31017916034 + pristine_git_object: df7d0ec6a0095ea3e6d1d2989eb2fa826f920229 + docs/models/previewmultiattachresetinterval.md: + id: d0d871495a37 + last_write_checksum: sha1:ab91f083983445f20326eb03068a6209bed862d5 + pristine_git_object: ec56bdecfc8eac78fffde4302cee7caed963686a + docs/models/previewmultiattachresponse.md: + id: 122c343c9098 + last_write_checksum: sha1:3ed4de99fa7c3415d4f66b0380b3602530bb356a + pristine_git_object: af5bfa5f8c156d2bca2f0f858dfad568e92966b6 + docs/models/previewmultiattachrollover.md: + id: 156269f00e06 + last_write_checksum: sha1:d757d222ff8014fa24d40928eb47984131ca6c76 + pristine_git_object: 3e69ac430bfc2ba6f413121d770bcb72f13b3162 + docs/models/previewmultiattachtier.md: + id: a075b8d3b1f1 + last_write_checksum: sha1:7173ef38ca367078c69b97bddd925d9eef3a5b39 + pristine_git_object: 6ae51fa03a46b59eeb9eb6b02da769475b6b6e58 + docs/models/previewmultiattachtierbehavior.md: + id: 698c1ad42dcd + last_write_checksum: sha1:3d8257623eb02e7febc36d389be1d536e3137939 + pristine_git_object: 76548a276b8599730a680f9aba2add68b23b82af + docs/models/previewmultiattachto.md: + id: f34b59fd5a7b + last_write_checksum: sha1:bdad4bc0149814f1518a28835e98401bd06d392d + pristine_git_object: 00224614a0f4c3cdbedca57e04bbb8b36b11ce2b docs/models/previewupdatebaseprice.md: id: 7eea7a31d277 last_write_checksum: sha1:56d6bb064864bad3a9353b50591d699e1edec722 @@ -1429,8 +1749,8 @@ trackedFiles: pristine_git_object: 23981bb307be3172cc89fd7a7a6afbdc1eaf856e docs/models/previewupdateprice.md: id: 4f88cb79503d - last_write_checksum: sha1:6dcc8aa441dfff2dbedee1c264a04691f4ef4bf8 - pristine_git_object: fba9c206e02bd3cbdbe09c665dd1259579caaed0 + last_write_checksum: sha1:44fbafbdcf04186fcff382b6c22c532ce0be2e26 + pristine_git_object: 636b73a20517aebee5661b5bee76b578c8adb2e0 docs/models/previewupdatepriceinterval.md: id: 300f908b2503 last_write_checksum: sha1:9c8866732d1777ff53a167166429c484d451c997 @@ -1461,8 +1781,12 @@ trackedFiles: pristine_git_object: 1487f97cf019f3b6e590b249c669cf6cf807c476 docs/models/previewupdatetier.md: id: bf6c0c1ebd66 - last_write_checksum: sha1:60c8e93724c44400c7624b387c71f4e9e7eaf902 - pristine_git_object: 07811547b3ae812f20e84aa4f6973d36ea3d9f37 + last_write_checksum: sha1:616a4baaeacab11b5b67d3ced3b74542aad53af2 + pristine_git_object: bad7cc9b3cabe311230b98605533f20790cf2b35 + docs/models/previewupdatetierbehavior.md: + id: e0ecb90f6fe5 + last_write_checksum: sha1:a53cb1a4ea349f2d8f7b0c657c16a0035d379f59 + pristine_git_object: 8a5b3f74ff2494837ea1d6f2085569c78a960472 docs/models/previewupdateto.md: id: c8706fb2f15e last_write_checksum: sha1:ee0c86ede67f157bc7d60c0dbe8c11567ee98418 @@ -1513,24 +1837,112 @@ trackedFiles: pristine_git_object: 556f622fc78575df4efda34f58c9dc8c7da7318b docs/models/scenario.md: id: e3aad8ab5efa - last_write_checksum: sha1:132dfc4d6a03ff1073be4390633a64afd909c700 - pristine_git_object: 58c924cbae30e7c3a227a04ab9655c97381be99a + last_write_checksum: sha1:7249b68f4a52628960519796e4b568b7e2252926 + pristine_git_object: 3c17423718a5212462b18bb3f6d93c68a6f3e0e9 docs/models/security.md: id: 452e4d4eb67a last_write_checksum: sha1:64787360e0bddbe1d2d2ede91992fa1a27c15a0e pristine_git_object: a5c3adda6c609878c33600537edbd46c90aa1711 + docs/models/setuppaymentattachdiscount.md: + id: d1cbe7d20ab5 + last_write_checksum: sha1:f128802b5e2a8466ce16024dbf3cb9b7a5ed6267 + pristine_git_object: 53fc7933fee507da4b362252d0a4cfc577d17536 + docs/models/setuppaymentbaseprice.md: + id: a123b4da0cd9 + last_write_checksum: sha1:c7a79d649599772f11188b78d7beb0a8c4d4adce + pristine_git_object: 77867b1b1a7917f32c17387092ae69eed9f843d7 + docs/models/setuppaymentbillingmethod.md: + id: 3048b32fa76c + last_write_checksum: sha1:128a736c42e76a6af1eb0350ad3b99068867c400 + pristine_git_object: 50b7f326fbf3fc4125a453dd50422f5dcb80c296 + docs/models/setuppaymentcustomize.md: + id: a4431aa0e152 + last_write_checksum: sha1:6a5dab703d167291dd68781fa214890203a96fdf + pristine_git_object: e674df8cb5d13a7785c437f9085f803adb82f898 + docs/models/setuppaymentdurationtype.md: + id: 05682f9ba3c6 + last_write_checksum: sha1:727d37a22da29f321f3b1104bf36a7ef09ca3d89 + pristine_git_object: 2f50fe56b53431668fcd8ffd939345127fee8f04 + docs/models/setuppaymentexpirydurationtype.md: + id: 31b912769b88 + last_write_checksum: sha1:59a3ed79a04580b80a36c7c4a3831358b50a2536 + pristine_git_object: 19b8fd2469069c21ab4b77f62c6b695ba3c0898d + docs/models/setuppaymentfeaturequantity.md: + id: d15328882840 + last_write_checksum: sha1:4f1f0642102d637333d8db0db558ed7d3270b379 + pristine_git_object: 6bdc4300c141d9891c81e0ea3ddd67abbb47466b + docs/models/setuppaymentfreetrialparams.md: + id: f427f4299d8f + last_write_checksum: sha1:544e50b5cfc6d346bb37b0e0c63f4ded4a28c42c + pristine_git_object: 6787505c592cc4b1262d61f42ccffa6753f9161b docs/models/setuppaymentglobals.md: id: 3c1e725a7564 last_write_checksum: sha1:822c35950651414cffcfbf989054afc107a8de68 pristine_git_object: e46150aa6597ad09d02461b1438d42eb20ad44cf + docs/models/setuppaymentitempriceinterval.md: + id: 6337a430ab96 + last_write_checksum: sha1:8dc0e5678b2a0221859198122d57bd0cda7914d8 + pristine_git_object: bfce67601550f16b24bb69be2c62fb51043fcc98 + docs/models/setuppaymentondecrease.md: + id: 6d4113b4eb77 + last_write_checksum: sha1:0bf24f17cdaa4982333094dc508b2184ee030291 + pristine_git_object: e35ae42fa4a7566b81b292e0a697eb42cecb76ac + docs/models/setuppaymentonincrease.md: + id: fa8cbaeccdec + last_write_checksum: sha1:6ab77cad16e4c3b6cb7ce4c216b4e921b2ff0d6e + pristine_git_object: 6888fb44e13c6ac1a3a20519abbc3c6b6da21c16 docs/models/setuppaymentparams.md: id: d71f82dde273 - last_write_checksum: sha1:9a980c84a736089264b8c32fb6bdacb3bf0d1010 - pristine_git_object: a2ab141be3a5d1231ab7c0c567eaa04121c5fa4d + last_write_checksum: sha1:ce8d07cfec422acf02102643000746b36865436e + pristine_git_object: 464bee1aa9a45f9232ef41830a3ff3654f232f91 + docs/models/setuppaymentplanitem.md: + id: b79b706606a1 + last_write_checksum: sha1:557beeeacbd10fa2e774d2b9e19f870cd0932d01 + pristine_git_object: 9cc4b36cd524aa66d881e7b27efbe7c248560af9 + docs/models/setuppaymentprice.md: + id: "383846276309" + last_write_checksum: sha1:4b2fe7c6b60df548c784af1f341e1db65500a409 + pristine_git_object: a7b596ba76c3edb1f48295df565fea57f9e38ac4 + docs/models/setuppaymentpriceinterval.md: + id: 6dd9488b58f0 + last_write_checksum: sha1:7341e34bd16262a6ce0fe03f616f352960f45882 + pristine_git_object: ad04914a4bcce2413bdc5404219e4d58c31ac52a + docs/models/setuppaymentproration.md: + id: 05a134dd45fc + last_write_checksum: sha1:5f4b5e93872db5597511d831a6e91b37fcccfc8d + pristine_git_object: 03eea5cf24522fae92de2f3edf22afe4dcfbb9eb + docs/models/setuppaymentprorationbehavior.md: + id: 96ded50f9766 + last_write_checksum: sha1:1453a79f84609625370edb54c99f5bc60da9fbfc + pristine_git_object: 4b78289cbfa4157f45b92da2382243db67e50abd + docs/models/setuppaymentreset.md: + id: 1136ec30628f + last_write_checksum: sha1:a650b96cb252f1d62f5d6a5e23ebea94959a0224 + pristine_git_object: 76cd91f39a87211852c4f8cfffba2ecc0d75437f + docs/models/setuppaymentresetinterval.md: + id: 38c4d903d5d0 + last_write_checksum: sha1:5e333d5badbb195def783ce1511ae61406310b55 + pristine_git_object: d3eb8e68ecc6a857af27ff4918df0bdfb3127a62 docs/models/setuppaymentresponse.md: id: a0fe36809906 - last_write_checksum: sha1:7a862495b69fa946bc361455439d24d9fdf3a3c0 - pristine_git_object: 06ac684aaa678cd7abfc4aef70f435d1637fecb6 + last_write_checksum: sha1:0506cb5fd620fb73affa03da445160a245e94fd6 + pristine_git_object: caa4f8813f21dd5e60c7f1fd5e7591340247fb1f + docs/models/setuppaymentrollover.md: + id: 6c173c7b7342 + last_write_checksum: sha1:516a4c08f522b77900ad67897f8bc68e83ee033d + pristine_git_object: 2dfe60c162a267d46e90c0ff0772e671383653f6 + docs/models/setuppaymenttier.md: + id: bccb3902ce14 + last_write_checksum: sha1:6d776253aa32177c8988a3a44686437989c83c6d + pristine_git_object: 88659dae2c7b521d925522df853e04aa3601e771 + docs/models/setuppaymenttierbehavior.md: + id: 882d41b17f9b + last_write_checksum: sha1:490c71713c9d35c83684d140e282e6706d219a77 + pristine_git_object: 403b2ac9f33aafaaed978d9958cbbc3d563e795d + docs/models/setuppaymentto.md: + id: 06660d546541 + last_write_checksum: sha1:f8a7cc7213fad6d967cdd1db038ec6eef381ba84 + pristine_git_object: 98cebb598d6bdb24880e5843f29961412e58401c docs/models/status.md: id: 959cd204aadf last_write_checksum: sha1:a475fcd3bc7f144921949a0d9bbb85529d986841 @@ -1545,8 +1957,8 @@ trackedFiles: pristine_git_object: 6751a76861dda8aafb85e42820a94f0f302c4dcc docs/models/tiers.md: id: 06571cdb201f - last_write_checksum: sha1:0ee377dbe82ca7d881cb10ff95fd3c05a68e5ab4 - pristine_git_object: 44493c9273ba6510fef774aabd96d8d8542aaa91 + last_write_checksum: sha1:d0ba92210c535c8d1447dcf45207d7cee42c45b4 + pristine_git_object: 23a8a919ef1d8d2ea3a9e4c0104d7b65481ce909 docs/models/total.md: id: f4060c3b4657 last_write_checksum: sha1:08c2c14481fcae1bcc1c550d6e2c95f14bb1efb0 @@ -1577,8 +1989,8 @@ trackedFiles: pristine_git_object: b4afc96b118bffa16de417ced419af3984696a68 docs/models/updatebalanceparams.md: id: 8bb20f144794 - last_write_checksum: sha1:235b42a1b577099ff5f3c483bed29f6693082176 - pristine_git_object: 9bc0da110f4ca28ed6fcea4455975f65fc9a0f9b + last_write_checksum: sha1:f211e00d1d482cdba89f7a6b95e044dee418e1e7 + pristine_git_object: 11408889c7c8ba52698868b51902a990fc18f463 docs/models/updatebalanceresponse.md: id: 5ed7899bff80 last_write_checksum: sha1:05b5eb2ab6aab3e89139f8faf25fd28c8e8d0554 @@ -1663,6 +2075,10 @@ trackedFiles: id: 00c090e1bf26 last_write_checksum: sha1:38829677cb91237900845a612c71c5341cecb59a pristine_git_object: b435b3f93c28f38a529ccf32beaf93c7941158c6 + docs/models/updateplancustomereligibility.md: + id: 90dd746e6246 + last_write_checksum: sha1:d39e2922c787fccc2bd0d4d75c8964e694dcd08c + pristine_git_object: 6a8beb6afc7e4107861364dabd1f080779617f3b docs/models/updateplandurationtyperequest.md: id: a2b05beb83e5 last_write_checksum: sha1:749717a358e65ef0d99188b259bb443fb3baeb5e @@ -1717,8 +2133,8 @@ trackedFiles: pristine_git_object: 01a0ae3b5e94f3e919869282da57d52b4ced9f1d docs/models/updateplanitempriceresponse.md: id: ad114972ca0e - last_write_checksum: sha1:5b3d13035deafd36d5e263a3157f4dd4101fe534 - pristine_git_object: e08dbd33959b48587491eceb0455e7ef5c269831 + last_write_checksum: sha1:1ad29e32271583224bde56baf5c2062fe7cf518b + pristine_git_object: c5d17c9290b33b73fb92a4107acb9fc589c7526c docs/models/updateplanondecrease.md: id: 02ccbf603191 last_write_checksum: sha1:2fd6b7131d7b287b55e4933cf56460a282e912dc @@ -1753,8 +2169,8 @@ trackedFiles: pristine_git_object: 97de36201b0ea99623c236027ac84971540b259b docs/models/updateplanpricerequest.md: id: 768f8e75b84e - last_write_checksum: sha1:eb7e9c522f667094051a0527947009b6f582bde8 - pristine_git_object: 311caebe1b29a3ea51b0414200785df26f1cbd35 + last_write_checksum: sha1:bc178ae450cc2d821c32d3c57c485a60e636cdc4 + pristine_git_object: 2b5bf329f901ac71cf6a2a5d85ea35fb729a79c7 docs/models/updateplanpriceresponse.md: id: 61ed2a03a5de last_write_checksum: sha1:8e99830778d69be073b959cf40ee78be83f7178e @@ -1781,8 +2197,8 @@ trackedFiles: pristine_git_object: 2b4c66a3228472b73baa794aa68198ac5ecd0195 docs/models/updateplanresponse.md: id: 1e9b63fce660 - last_write_checksum: sha1:276364f198c277eb5c59e355f3b9bbfdc8b0bd78 - pristine_git_object: 39af2f1d5d9316e8bed19bd7c76bb76d00b0500e + last_write_checksum: sha1:834d9eb74081052e10a1eb48f97bdc9179c4b1aa + pristine_git_object: 15046100d10460c95660651bbad3d87dea398ca5 docs/models/updateplanrolloverrequest.md: id: 9b30d0aaa790 last_write_checksum: sha1:8fd54549b63ad2f2035ba69b2495dc76b3a969b9 @@ -1791,14 +2207,26 @@ trackedFiles: id: 0a52d5c7913f last_write_checksum: sha1:c6f5bcad7bce5275d84401625b4cdafeddb69c4c pristine_git_object: c9c19d637b8d395bf116699d8ea2d732dfa0e707 + docs/models/updateplanscenario.md: + id: 96e462817d3c + last_write_checksum: sha1:4c55f6695691de2b59859351fd42efd0bde5e4c2 + pristine_git_object: ed845a2530e63acefebd5447670430f5ee8d32c0 + docs/models/updateplantierbehaviorrequest.md: + id: 73b92d1c113f + last_write_checksum: sha1:302dc2df6776fa7a58b457c96b0cdf18b9929684 + pristine_git_object: d686303fb8b882a57f194b1de35bfd2c9ec3c0d2 + docs/models/updateplantierbehaviorresponse.md: + id: 4cf0cabdcb8d + last_write_checksum: sha1:089f2448f428d3bbf1e4578e9d8da9e2ef15ff7a + pristine_git_object: 24ed2e85cb8ee0323c161b19948b70eb4ce73e20 docs/models/updateplantierrequest.md: id: 89f1585fb63e - last_write_checksum: sha1:25c314dd288c205f5c3c485048f0fc1ffb12241f - pristine_git_object: e07dfc6857cc0e48cec7fde1c570a55819654363 + last_write_checksum: sha1:2d32af4be084535e2341e18d38ad1a19b3153b5d + pristine_git_object: 9467688aff57b3eb5fef3c26af21143444de2c8a docs/models/updateplantierresponse.md: id: 51ec5eb77420 - last_write_checksum: sha1:15559f85d049d60be933431a90d79bc351e89fdb - pristine_git_object: 7c03b59f7e3106d19a05f4e6a695129c8d9c9f44 + last_write_checksum: sha1:c44395663daf3e75c110c76cca64d4e233c4cbec + pristine_git_object: 603327733c4b50f323bcb205b0538461583c01b3 docs/models/updateplantorequest.md: id: f113605d7dc2 last_write_checksum: sha1:1a9d31ceafbd45d2def3c1ec20dc31e81c82cfd2 @@ -1829,12 +2257,12 @@ trackedFiles: pristine_git_object: e71ec2951397e3d106e2edc7ee83fecab2a6765e docs/sdks/balances/README.md: id: 6ca85866f00d - last_write_checksum: sha1:fc865ea70246af1e0921ae75a63017e3a0d8a3bc - pristine_git_object: e8485686a84a2f06d13365bb44e01a72015de6f9 + last_write_checksum: sha1:0663504163e378a202835590cafcf14af02f813e + pristine_git_object: 535e9129042cbd7b1bd5e2989fe0689a59ba1357 docs/sdks/billing/README.md: id: dc915331dd9d - last_write_checksum: sha1:f1f1432036f7761f27a6d4513ab5510a571e24ba - pristine_git_object: c9f5267aa7c1b190c1c748c3e1b5582750b4e70d + last_write_checksum: sha1:2dc163ba66ef8d9789c24e08d9a65473ef84a720 + pristine_git_object: 699fadb47f7c4e1c434ebc164b7b8446c2247941 docs/sdks/customers/README.md: id: 9332759cffc2 last_write_checksum: sha1:13ccde8e19cf24ebf4afdac645940c09a642d652 @@ -1881,12 +2309,12 @@ trackedFiles: pristine_git_object: 833c68cd526fe34aab2b7e7c45f974f7f4b9e120 src/autumn_sdk/_hooks/__init__.py: id: 9cc0f4a4b4f1 - last_write_checksum: sha1:e3111289afd28ad557c21d9e2f918caabfb7037d - pristine_git_object: 2ee66cdd592fe41731c24ddd407c8ca31c50aec1 + last_write_checksum: sha1:45a380490e968d8d95994dd97554ac60eeb6ae60 + pristine_git_object: e763be4b171bbcf9c16caeaf381f8c92ce8d8e6e src/autumn_sdk/_hooks/sdkhooks.py: id: 44a3b91b081a - last_write_checksum: sha1:aa048f851cf2d0282481e0f74f220a1efa9fd7d1 - pristine_git_object: 243e0a91b158b2a5bff9c640d2aeeb8b1ce37361 + last_write_checksum: sha1:b8b2d696202efa89c27951556d050fe6a8972f8e + pristine_git_object: a147dce01cf57809561b2b16c9c752a42e9f99bc src/autumn_sdk/_hooks/types.py: id: f938ddbbb3a7 last_write_checksum: sha1:de7842637a90364a72c1cf63807f25576c27a27f @@ -1897,16 +2325,16 @@ trackedFiles: pristine_git_object: 640279bb0265e22047255effeeec245c86c47396 src/autumn_sdk/balances.py: id: 0a15be654dad - last_write_checksum: sha1:bcef18a651842ffe96a5a72f608c4c37e2443bf7 - pristine_git_object: f4597b00fe140fa9540f6301a72db3a883355a1e + last_write_checksum: sha1:9e6f5c38b59c6f5812443bd7664e286356906b87 + pristine_git_object: d36d47dfe3f22549d7618b4260bc08a27eaeca10 src/autumn_sdk/basesdk.py: id: 8c9c35fe744d last_write_checksum: sha1:5d6abacbd251bd806538b19ab9662994bbfc6e24 pristine_git_object: b8da96bd89ddafaedb32f4ecac64c27027fcca79 src/autumn_sdk/billing.py: id: e6cffdbf2221 - last_write_checksum: sha1:d16e851fed00ca716be62cf6dcee0c19ed9d0f39 - pristine_git_object: 4784b15e3161d001fcebe02db3416c581b43266c + last_write_checksum: sha1:0b24c171a66488756b6cb08e9785949a234c40ad + pristine_git_object: 9ef64f87727a3810f4e03e608a2c26cede62ab7c src/autumn_sdk/customers.py: id: 5c5a0a07a433 last_write_checksum: sha1:d34a9c1215e7685f15ef88c049e707d9c47163e7 @@ -1949,28 +2377,28 @@ trackedFiles: pristine_git_object: 89560b566073785535643e694c112bedbd3db13d src/autumn_sdk/models/__init__.py: id: bcf3802243ff - last_write_checksum: sha1:8e4566db84eb18c925c3f0e7ab049c5110a4b991 - pristine_git_object: f928e1235a09aa2e5e020fa21675f1b4e209b578 + last_write_checksum: sha1:55c926d04a2dda97094173b8312d6a370b32fe08 + pristine_git_object: f7ee582d03476470074ab0a92ac331e9839fba84 src/autumn_sdk/models/aggregateeventsop.py: id: 01321099f2a5 last_write_checksum: sha1:2adb01a9d319cd46833411082c88c0a49910546d pristine_git_object: 0cfe4b5890b74130e863be0f965edb838b324a7f + src/autumn_sdk/models/attachop.py: + id: ebb59e06476c + last_write_checksum: sha1:f07a249892f2839d4df28910cc8bbba62298fe44 + pristine_git_object: d6eeb9edf924c114fb189352f1d2780e0f38302c src/autumn_sdk/models/balance.py: id: a6354d7c4b97 - last_write_checksum: sha1:e054e99379dc9480b9037e8ed0d97cca487372bc - pristine_git_object: 30665ef90067900c833e72a3c066687c03fa2b3a - src/autumn_sdk/models/billingattachop.py: - id: a3c4907bef48 - last_write_checksum: sha1:dc8bfbd7421b708a4a51925c6bd81a86346c5df6 - pristine_git_object: d16b8c47dbd3c254c3c7ace912218e9928b08c2d + last_write_checksum: sha1:c5d4fa8eab9f785e7700345c4ca695920d24258a + pristine_git_object: 32a43911c46f2673d0c9e043240459d3e60b17f3 src/autumn_sdk/models/billingupdateop.py: id: a2f17c75cfd3 - last_write_checksum: sha1:2fd1779ebb29d156183e2a34f2730272b3195be1 - pristine_git_object: bbb2d7a24087924c42bd77d56cea0395e8d1e07d + last_write_checksum: sha1:48aea2775c2347ec2ecb38e20db79235feba8baf + pristine_git_object: 9566031633d7b3a5c9b5dbcd2bb661e0b19a0f0c src/autumn_sdk/models/checkop.py: id: 31c2f84723c6 - last_write_checksum: sha1:739049de845629f70c56a5cd5c202dabfdc6b59f - pristine_git_object: 21a4f89c09c418387e52d10887b81556c5106bfd + last_write_checksum: sha1:cf3b6fe5e9a112693981093c393cf9f8db8bda8b + pristine_git_object: 935fa6bdfef854f5c004942f6c1c0cc5a01fd844 src/autumn_sdk/models/createbalanceop.py: id: 27daf4da75bf last_write_checksum: sha1:34b47fdbbbd50d3b08e6a1a0a060afc78f1262df @@ -1985,8 +2413,8 @@ trackedFiles: pristine_git_object: 562905c31e832ef5ebba913bf3a859bcb14c6f92 src/autumn_sdk/models/createplanop.py: id: 077e6c7db2ad - last_write_checksum: sha1:f593fdb990051232d8a4f876bee34ab57dd17ac9 - pristine_git_object: 1acc2509e59989764dc5777e5975dd8d98a330f7 + last_write_checksum: sha1:2cf7486f86c1d5117ff3a6e89ab02269f4499545 + pristine_git_object: 458dd0bebe86d45fd139e9868ae1e203ecc3b790 src/autumn_sdk/models/createreferralcodeop.py: id: 2f5f7b136c39 last_write_checksum: sha1:d0038bf28487af519cea4610bd34ba21cd8f99c1 @@ -2033,8 +2461,8 @@ trackedFiles: pristine_git_object: 6f59baae0a062bf5955a4501af2381b3ffad5857 src/autumn_sdk/models/getplanop.py: id: 590fb77ac88d - last_write_checksum: sha1:15cbe342d3b3b81ed365e82923241809d7e2a572 - pristine_git_object: 9f3389434c7fabbd394ba776ae74204af0a2608c + last_write_checksum: sha1:631498a5ef91b0aec8a12fb2f4618d403c596845 + pristine_git_object: bdd87c24fac1460c2a16483896ab181c1e755026 src/autumn_sdk/models/internal/__init__.py: id: 2906fe7f2cde last_write_checksum: sha1:5beaf7e5a713d3eead465c6edcfdeb7f8076175c @@ -2057,24 +2485,32 @@ trackedFiles: pristine_git_object: a95ba349b4dd8c3f72cdda328b0b406b205eff3d src/autumn_sdk/models/listplansop.py: id: fdf892c403f4 - last_write_checksum: sha1:dbbc9678cd8718df4751552807935cccbf2a0904 - pristine_git_object: 43c39a4afdbfe07bcea035aea51a518e053b8e8b + last_write_checksum: sha1:1bc5af0721d6112071e6407e82695ee06b084b0a + pristine_git_object: a42050e77d7066ed1b575c14eafe6c4fddd1dd9a + src/autumn_sdk/models/multiattachop.py: + id: dfdf7952c870 + last_write_checksum: sha1:acf738fcd80a4b3388016fe1f0caa65968b1ebcc + pristine_git_object: 822fc23262cbc089d62183945ebbc935c5cee625 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:39c42975096e0f28f6945b782682579abf30f950 - pristine_git_object: 76e8c1505e9102308c14c632d8b5193ee79ea500 + last_write_checksum: sha1:e336d0bcf4e56997c31f2d013c11d185de2aadf0 + pristine_git_object: 67266550aafcab2c9d30c56cc99d65a755eef8b2 src/autumn_sdk/models/previewattachop.py: id: 2b361be4bfa8 - last_write_checksum: sha1:34daff3d33e88310919123e3e5115f2eac584275 - pristine_git_object: 085ab62381ab70004249565a691572bcf4e77e7a + last_write_checksum: sha1:bdf84318f35d9fe058d0c55cc1cb4e4db3d31615 + pristine_git_object: 4b61a868a8baed8da7f3cfce788ec4eb56e0cb52 + src/autumn_sdk/models/previewmultiattachop.py: + id: 963ffcd646a4 + last_write_checksum: sha1:33942507f3d886d3f7f9f535262db270a1985d4e + pristine_git_object: 5ef6648c78b3a8276c016318550e6cfe7ad95be2 src/autumn_sdk/models/previewupdateop.py: id: 081d5f08508d - last_write_checksum: sha1:e8aacc33933052ab674cf366daa0343d61bb5da0 - pristine_git_object: 1bcbcafa4aaecbe45678421a1f1567b96189fde1 + last_write_checksum: sha1:8317b919da1981619f49f6c5c2c669a86ceee745 + pristine_git_object: facd7b91f8637673c0b4dbdc47f0189e6106056b src/autumn_sdk/models/redeemreferralcodeop.py: id: 0abd7bfae718 last_write_checksum: sha1:9096caecd5e39572e409302b99c6c89be0ae9add @@ -2085,16 +2521,16 @@ trackedFiles: pristine_git_object: aa686dd6f85ae1e27450392fcfe02527adfe8e61 src/autumn_sdk/models/setuppaymentop.py: id: 603339ee67e3 - last_write_checksum: sha1:816cc9c4c952c1a0958d9b661a2defd94c30718b - pristine_git_object: 9ae3881ae67544fed92f8867a2b0afe449926b30 + last_write_checksum: sha1:0b32c9ee94c1e45301d48ee821c44d43dac594d7 + pristine_git_object: b9c38d78406521b28f17aa148c60bab7bd567519 src/autumn_sdk/models/trackop.py: id: 2a744315e781 last_write_checksum: sha1:6b678a5fe2b9b2cd1a2d690edcec1f53528338ec pristine_git_object: 9c7d0df6601b1d44153685012748d354d22661f4 src/autumn_sdk/models/updatebalanceop.py: id: cd80d90d4cae - last_write_checksum: sha1:92a2e3567d9e5051240e77ee550ac000c19955e9 - pristine_git_object: 7f7e115039d939900fd38ca00484f71c5a51e030 + last_write_checksum: sha1:f1fcbc6df82352b36cd99692d4df1206c3891c65 + pristine_git_object: debe6d19234f930b8989e0602afb08a4be96f85f src/autumn_sdk/models/updatecustomerop.py: id: 28b9d5b59bae last_write_checksum: sha1:1183bd524115bdbad9cd35d1669d1b986ec6c42d @@ -2105,8 +2541,8 @@ trackedFiles: pristine_git_object: 15986b41d5fc3e0c733e4eea64805aea50933918 src/autumn_sdk/models/updateplanop.py: id: 753ddf45ca40 - last_write_checksum: sha1:082f2fee3c33cd7c9bdbf9b99f6155b47b46201e - pristine_git_object: f0dcfaafb04795fc3dbea54ecb5d919956eff189 + last_write_checksum: sha1:cffadae291097a4a55dd05ee7f133bae819d239f + pristine_git_object: 8a6db074483f90c9b973c464ce10f8973a1357a4 src/autumn_sdk/plans.py: id: cf1ebabb687c last_write_checksum: sha1:44a5f21bcc8df9df4590ec75c3296e7c0b726323 @@ -2228,10 +2664,10 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"customer_id": "cus_123", "plan_id": "pro_plan", "redirect_mode": "always"} + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan"} responses: "200": - application/json: {"customer_id": "cus_123", "payment_url": null} + application/json: {"customer_id": "cus_123", "payment_url": "https://checkout.stripe.com/..."} getOrCreateCustomer: speakeasy-default-get-or-create-customer: parameters: @@ -2411,7 +2847,7 @@ examples: application/json: {"customer_id": "cus_123", "success_url": "https://example.com/account/billing"} responses: "200": - application/json: {"customer_id": "cus_123", "url": "https://courteous-emergent.name"} + application/json: {"customer_id": "cus_123", "url": "https://checkout.stripe.com/..."} previewBillingUpdate: speakeasy-default-preview-billing-update: parameters: @@ -2670,4 +3106,34 @@ examples: responses: "200": application/json: {"success": false} + billingMultiAttach: + speakeasy-default-billing-multi-attach: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plans": [{"plan_id": "pro_plan"}, {"plan_id": "addon_seats", "feature_quantities": [{"feature_id": "seats", "quantity": 5}]}], "redirect_mode": "if_required"} + responses: + "200": + application/json: {"customer_id": "cus_123", "invoice": {"status": "paid", "stripe_id": "in_1234", "total": 4900, "currency": "usd", "hosted_invoice_url": "https://invoice.stripe.com/..."}, "payment_url": null} + previewMultiAttach: + speakeasy-default-preview-multi-attach: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plans": [{"plan_id": "pro_plan"}, {"plan_id": "addon_seats", "feature_quantities": [{"feature_id": "seats", "quantity": 5}]}], "redirect_mode": "if_required"} + responses: + "200": + application/json: {"customer_id": "", "line_items": [{"title": "", "description": "as unfortunately wherever crest", "amount": 1446.82}], "total": 20, "currency": "usd"} + multiAttach: + speakeasy-default-multi-attach: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plans": [{"plan_id": "pro_plan"}, {"plan_id": "addon_seats", "feature_quantities": [{"feature_id": "seats", "quantity": 5}]}], "redirect_mode": "if_required"} + responses: + "200": + application/json: {"customer_id": "cus_123", "invoice": {"status": "paid", "stripe_id": "in_1234", "total": 4900, "currency": "usd", "hosted_invoice_url": "https://invoice.stripe.com/..."}, "payment_url": null} examplesVersion: 1.0.2 diff --git a/others/python-sdk/.speakeasy/gen.yaml b/others/python-sdk/.speakeasy/gen.yaml index 745c6bb57..1af4d112c 100644 --- a/others/python-sdk/.speakeasy/gen.yaml +++ b/others/python-sdk/.speakeasy/gen.yaml @@ -15,8 +15,8 @@ generation: sharedErrorComponentsApr2025: true sharedNestedComponentsJan2026: true auth: - oAuth2ClientCredentialsEnabled: true - oAuth2PasswordEnabled: true + oAuth2ClientCredentialsEnabled: false + oAuth2PasswordEnabled: false hoistGlobalSecurity: true inferSSEOverload: true sdkHooksConfigAccess: true diff --git a/others/python-sdk/README.md b/others/python-sdk/README.md index fe9b69db3..e16023b85 100644 --- a/others/python-sdk/README.md +++ b/others/python-sdk/README.md @@ -217,9 +217,15 @@ Use this after an action happens to decrement usage, or send a negative value to * [attach](docs/sdks/billing/README.md#attach) - Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. +* [multi_attach](docs/sdks/billing/README.md#multi_attach) - Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated. + +Use this endpoint when you need to subscribe a customer to multiple plans at once, such as a base plan plus add-ons, or to create a bundle of products. * [preview_attach](docs/sdks/billing/README.md#preview_attach) - Previews the billing changes that would occur when attaching a plan, without actually making any changes. Use this endpoint to show customers what they will be charged before confirming a subscription change. +* [preview_multi_attach](docs/sdks/billing/README.md#preview_multi_attach) - Previews the billing changes that would occur when attaching multiple plans, without actually making any changes. + +Use this endpoint to show customers what they will be charged before confirming a multi-plan subscription. * [update](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. diff --git a/others/python-sdk/src/autumn_sdk/_hooks/__init__.py b/others/python-sdk/src/autumn_sdk/_hooks/__init__.py index 2ee66cdd5..e763be4b1 100644 --- a/others/python-sdk/src/autumn_sdk/_hooks/__init__.py +++ b/others/python-sdk/src/autumn_sdk/_hooks/__init__.py @@ -2,4 +2,3 @@ from .sdkhooks import * from .types import * -from .registration import * diff --git a/others/python-sdk/src/autumn_sdk/_hooks/sdkhooks.py b/others/python-sdk/src/autumn_sdk/_hooks/sdkhooks.py index 243e0a91b..a147dce01 100644 --- a/others/python-sdk/src/autumn_sdk/_hooks/sdkhooks.py +++ b/others/python-sdk/src/autumn_sdk/_hooks/sdkhooks.py @@ -11,7 +11,6 @@ from .types import ( AfterErrorHook, Hooks, ) -from .registration import init_hooks from typing import List, Optional, Tuple from autumn_sdk.sdkconfiguration import SDKConfiguration @@ -22,7 +21,6 @@ class SDKHooks(Hooks): self.before_request_hooks: List[BeforeRequestHook] = [] self.after_success_hooks: List[AfterSuccessHook] = [] self.after_error_hooks: List[AfterErrorHook] = [] - init_hooks(self) def register_sdk_init_hook(self, hook: SDKInitHook) -> None: self.sdk_init_hooks.append(hook) diff --git a/others/python-sdk/src/autumn_sdk/balances.py b/others/python-sdk/src/autumn_sdk/balances.py index f4597b00f..d36d47dfe 100644 --- a/others/python-sdk/src/autumn_sdk/balances.py +++ b/others/python-sdk/src/autumn_sdk/balances.py @@ -237,6 +237,7 @@ class Balances(BaseSDK): entity_id: Optional[str] = None, remaining: Optional[float] = None, add_to_balance: Optional[float] = None, + usage: Optional[float] = None, interval: Optional[models.UpdateBalanceInterval] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -250,6 +251,7 @@ class Balances(BaseSDK): :param entity_id: The ID of the entity for entity-scoped balances (e.g., per-seat limits). :param remaining: Set the remaining balance to this exact value. Cannot be combined with add_to_balance. :param add_to_balance: Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance. + :param usage: The usage amount to update. Cannot be combined with remaining or add_to_balance. :param interval: Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -272,6 +274,7 @@ class Balances(BaseSDK): entity_id=entity_id, remaining=remaining, add_to_balance=add_to_balance, + usage=usage, interval=interval, ) @@ -342,6 +345,7 @@ class Balances(BaseSDK): entity_id: Optional[str] = None, remaining: Optional[float] = None, add_to_balance: Optional[float] = None, + usage: Optional[float] = None, interval: Optional[models.UpdateBalanceInterval] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -355,6 +359,7 @@ class Balances(BaseSDK): :param entity_id: The ID of the entity for entity-scoped balances (e.g., per-seat limits). :param remaining: Set the remaining balance to this exact value. Cannot be combined with add_to_balance. :param add_to_balance: Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance. + :param usage: The usage amount to update. Cannot be combined with remaining or add_to_balance. :param interval: Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -377,6 +382,7 @@ class Balances(BaseSDK): entity_id=entity_id, remaining=remaining, add_to_balance=add_to_balance, + usage=usage, interval=interval, ) diff --git a/others/python-sdk/src/autumn_sdk/billing.py b/others/python-sdk/src/autumn_sdk/billing.py index 4784b15e3..9ef64f877 100644 --- a/others/python-sdk/src/autumn_sdk/billing.py +++ b/others/python-sdk/src/autumn_sdk/billing.py @@ -17,35 +17,33 @@ class Billing(BaseSDK): entity_id: Optional[str] = None, feature_quantities: Optional[ Union[ - List[models.BillingAttachFeatureQuantity], - List[models.BillingAttachFeatureQuantityTypedDict], + List[models.AttachFeatureQuantity], + List[models.AttachFeatureQuantityTypedDict], ] ] = None, version: Optional[float] = None, customize: Optional[ - Union[models.BillingAttachCustomize, models.BillingAttachCustomizeTypedDict] + Union[models.AttachCustomize, models.AttachCustomizeTypedDict] ] = None, invoice_mode: Optional[ - Union[ - models.BillingAttachInvoiceMode, - models.BillingAttachInvoiceModeTypedDict, - ] + Union[models.AttachInvoiceMode, models.AttachInvoiceModeTypedDict] ] = None, - proration_behavior: Optional[models.BillingAttachProrationBehavior] = None, + proration_behavior: Optional[models.AttachProrationBehavior] = None, discounts: Optional[ Union[ - List[models.BillingAttachAttachDiscount], - List[models.BillingAttachAttachDiscountTypedDict], + List[models.AttachAttachDiscount], + List[models.AttachAttachDiscountTypedDict], ] ] = None, success_url: Optional[str] = None, new_billing_subscription: Optional[bool] = None, - plan_schedule: Optional[models.BillingAttachPlanSchedule] = None, + plan_schedule: Optional[models.AttachPlanSchedule] = 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.BillingAttachResponse: + ) -> models.AttachResponse: r"""Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. @@ -62,6 +60,7 @@ class Billing(BaseSDK): :param success_url: URL to redirect to after successful checkout. :param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. :param plan_schedule: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + :param checkout_session_params: Additional parameters to pass into the creation of the Stripe 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 @@ -82,22 +81,23 @@ class Billing(BaseSDK): entity_id=entity_id, plan_id=plan_id, feature_quantities=utils.get_pydantic_model( - feature_quantities, Optional[List[models.BillingAttachFeatureQuantity]] + feature_quantities, Optional[List[models.AttachFeatureQuantity]] ), version=version, customize=utils.get_pydantic_model( - customize, Optional[models.BillingAttachCustomize] + customize, Optional[models.AttachCustomize] ), invoice_mode=utils.get_pydantic_model( - invoice_mode, Optional[models.BillingAttachInvoiceMode] + invoice_mode, Optional[models.AttachInvoiceMode] ), proration_behavior=proration_behavior, discounts=utils.get_pydantic_model( - discounts, Optional[List[models.BillingAttachAttachDiscount]] + discounts, Optional[List[models.AttachAttachDiscount]] ), success_url=success_url, new_billing_subscription=new_billing_subscription, plan_schedule=plan_schedule, + checkout_session_params=checkout_session_params, ) req = self._build_request( @@ -112,7 +112,7 @@ class Billing(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.BillingAttachGlobals( + _globals=models.AttachGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, @@ -135,7 +135,7 @@ class Billing(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="billingAttach", + operation_id="attach", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -145,7 +145,7 @@ class Billing(BaseSDK): ) if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(models.BillingAttachResponse, http_res) + return unmarshal_json_response(models.AttachResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise errors.AutumnDefaultError( @@ -167,35 +167,33 @@ class Billing(BaseSDK): entity_id: Optional[str] = None, feature_quantities: Optional[ Union[ - List[models.BillingAttachFeatureQuantity], - List[models.BillingAttachFeatureQuantityTypedDict], + List[models.AttachFeatureQuantity], + List[models.AttachFeatureQuantityTypedDict], ] ] = None, version: Optional[float] = None, customize: Optional[ - Union[models.BillingAttachCustomize, models.BillingAttachCustomizeTypedDict] + Union[models.AttachCustomize, models.AttachCustomizeTypedDict] ] = None, invoice_mode: Optional[ - Union[ - models.BillingAttachInvoiceMode, - models.BillingAttachInvoiceModeTypedDict, - ] + Union[models.AttachInvoiceMode, models.AttachInvoiceModeTypedDict] ] = None, - proration_behavior: Optional[models.BillingAttachProrationBehavior] = None, + proration_behavior: Optional[models.AttachProrationBehavior] = None, discounts: Optional[ Union[ - List[models.BillingAttachAttachDiscount], - List[models.BillingAttachAttachDiscountTypedDict], + List[models.AttachAttachDiscount], + List[models.AttachAttachDiscountTypedDict], ] ] = None, success_url: Optional[str] = None, new_billing_subscription: Optional[bool] = None, - plan_schedule: Optional[models.BillingAttachPlanSchedule] = None, + plan_schedule: Optional[models.AttachPlanSchedule] = 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.BillingAttachResponse: + ) -> models.AttachResponse: r"""Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. @@ -212,6 +210,7 @@ class Billing(BaseSDK): :param success_url: URL to redirect to after successful checkout. :param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. :param plan_schedule: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + :param checkout_session_params: Additional parameters to pass into the creation of the Stripe 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 @@ -232,22 +231,23 @@ class Billing(BaseSDK): entity_id=entity_id, plan_id=plan_id, feature_quantities=utils.get_pydantic_model( - feature_quantities, Optional[List[models.BillingAttachFeatureQuantity]] + feature_quantities, Optional[List[models.AttachFeatureQuantity]] ), version=version, customize=utils.get_pydantic_model( - customize, Optional[models.BillingAttachCustomize] + customize, Optional[models.AttachCustomize] ), invoice_mode=utils.get_pydantic_model( - invoice_mode, Optional[models.BillingAttachInvoiceMode] + invoice_mode, Optional[models.AttachInvoiceMode] ), proration_behavior=proration_behavior, discounts=utils.get_pydantic_model( - discounts, Optional[List[models.BillingAttachAttachDiscount]] + discounts, Optional[List[models.AttachAttachDiscount]] ), success_url=success_url, new_billing_subscription=new_billing_subscription, plan_schedule=plan_schedule, + checkout_session_params=checkout_session_params, ) req = self._build_request_async( @@ -262,7 +262,7 @@ class Billing(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.BillingAttachGlobals( + _globals=models.AttachGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, @@ -285,7 +285,7 @@ class Billing(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="billingAttach", + operation_id="attach", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -295,7 +295,313 @@ class Billing(BaseSDK): ) if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(models.BillingAttachResponse, http_res) + return unmarshal_json_response(models.AttachResponse, 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 multi_attach( + self, + *, + customer_id: str, + plans: Union[ + List[models.MultiAttachPlan], List[models.MultiAttachPlanTypedDict] + ], + entity_id: Optional[str] = None, + free_trial: OptionalNullable[ + Union[ + models.MultiAttachFreeTrialParams, + models.MultiAttachFreeTrialParamsTypedDict, + ] + ] = UNSET, + invoice_mode: Optional[ + Union[models.MultiAttachInvoiceMode, models.MultiAttachInvoiceModeTypedDict] + ] = None, + discounts: Optional[ + Union[ + List[models.MultiAttachAttachDiscount], + List[models.MultiAttachAttachDiscountTypedDict], + ] + ] = None, + success_url: Optional[str] = None, + checkout_session_params: Optional[Dict[str, Any]] = None, + redirect_mode: Optional[models.MultiAttachRedirectMode] = "if_required", + new_billing_subscription: Optional[bool] = None, + customer_data: Optional[ + Union[models.CustomerData, models.CustomerDataTypedDict] + ] = None, + entity_data: Optional[ + Union[models.MultiAttachEntityData, models.MultiAttachEntityDataTypedDict] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.MultiAttachResponse: + r"""Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated. + + Use this endpoint when you need to subscribe a customer to multiple plans at once, such as a base plan plus add-ons, or to create a bundle of products. + + :param customer_id: The ID of the customer to attach the plans to. + :param plans: The list of plans to attach to the customer. + :param entity_id: The ID of the entity to attach the plans to. + :param free_trial: Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. + :param invoice_mode: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. + :param discounts: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + :param success_url: URL to redirect to after successful checkout. + :param checkout_session_params: Additional parameters to pass into the creation of the Stripe checkout session. + :param redirect_mode: Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. + :param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + :param customer_data: Customer details to set when creating a customer + :param entity_data: + :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.MultiAttachParams( + customer_id=customer_id, + entity_id=entity_id, + plans=utils.get_pydantic_model(plans, List[models.MultiAttachPlan]), + free_trial=utils.get_pydantic_model( + free_trial, OptionalNullable[models.MultiAttachFreeTrialParams] + ), + invoice_mode=utils.get_pydantic_model( + invoice_mode, Optional[models.MultiAttachInvoiceMode] + ), + discounts=utils.get_pydantic_model( + discounts, Optional[List[models.MultiAttachAttachDiscount]] + ), + success_url=success_url, + checkout_session_params=checkout_session_params, + redirect_mode=redirect_mode, + new_billing_subscription=new_billing_subscription, + customer_data=utils.get_pydantic_model( + customer_data, Optional[models.CustomerData] + ), + entity_data=utils.get_pydantic_model( + entity_data, Optional[models.MultiAttachEntityData] + ), + ) + + req = self._build_request( + method="POST", + path="/v1/billing.multi_attach", + 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.MultiAttachGlobals( + 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.MultiAttachParams + ), + 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="multiAttach", + 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.MultiAttachResponse, 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 multi_attach_async( + self, + *, + customer_id: str, + plans: Union[ + List[models.MultiAttachPlan], List[models.MultiAttachPlanTypedDict] + ], + entity_id: Optional[str] = None, + free_trial: OptionalNullable[ + Union[ + models.MultiAttachFreeTrialParams, + models.MultiAttachFreeTrialParamsTypedDict, + ] + ] = UNSET, + invoice_mode: Optional[ + Union[models.MultiAttachInvoiceMode, models.MultiAttachInvoiceModeTypedDict] + ] = None, + discounts: Optional[ + Union[ + List[models.MultiAttachAttachDiscount], + List[models.MultiAttachAttachDiscountTypedDict], + ] + ] = None, + success_url: Optional[str] = None, + checkout_session_params: Optional[Dict[str, Any]] = None, + redirect_mode: Optional[models.MultiAttachRedirectMode] = "if_required", + new_billing_subscription: Optional[bool] = None, + customer_data: Optional[ + Union[models.CustomerData, models.CustomerDataTypedDict] + ] = None, + entity_data: Optional[ + Union[models.MultiAttachEntityData, models.MultiAttachEntityDataTypedDict] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.MultiAttachResponse: + r"""Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated. + + Use this endpoint when you need to subscribe a customer to multiple plans at once, such as a base plan plus add-ons, or to create a bundle of products. + + :param customer_id: The ID of the customer to attach the plans to. + :param plans: The list of plans to attach to the customer. + :param entity_id: The ID of the entity to attach the plans to. + :param free_trial: Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. + :param invoice_mode: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. + :param discounts: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + :param success_url: URL to redirect to after successful checkout. + :param checkout_session_params: Additional parameters to pass into the creation of the Stripe checkout session. + :param redirect_mode: Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. + :param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + :param customer_data: Customer details to set when creating a customer + :param entity_data: + :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.MultiAttachParams( + customer_id=customer_id, + entity_id=entity_id, + plans=utils.get_pydantic_model(plans, List[models.MultiAttachPlan]), + free_trial=utils.get_pydantic_model( + free_trial, OptionalNullable[models.MultiAttachFreeTrialParams] + ), + invoice_mode=utils.get_pydantic_model( + invoice_mode, Optional[models.MultiAttachInvoiceMode] + ), + discounts=utils.get_pydantic_model( + discounts, Optional[List[models.MultiAttachAttachDiscount]] + ), + success_url=success_url, + checkout_session_params=checkout_session_params, + redirect_mode=redirect_mode, + new_billing_subscription=new_billing_subscription, + customer_data=utils.get_pydantic_model( + customer_data, Optional[models.CustomerData] + ), + entity_data=utils.get_pydantic_model( + entity_data, Optional[models.MultiAttachEntityData] + ), + ) + + req = self._build_request_async( + method="POST", + path="/v1/billing.multi_attach", + 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.MultiAttachGlobals( + 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.MultiAttachParams + ), + 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="multiAttach", + 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.MultiAttachResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.AutumnDefaultError( @@ -341,6 +647,7 @@ class Billing(BaseSDK): success_url: Optional[str] = None, new_billing_subscription: Optional[bool] = None, plan_schedule: Optional[models.PreviewAttachPlanSchedule] = None, + checkout_session_params: Optional[Dict[str, Any]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -362,6 +669,7 @@ class Billing(BaseSDK): :param success_url: URL to redirect to after successful checkout. :param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. :param plan_schedule: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + :param checkout_session_params: Additional parameters to pass into the creation of the Stripe 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 @@ -398,6 +706,7 @@ class Billing(BaseSDK): success_url=success_url, new_billing_subscription=new_billing_subscription, plan_schedule=plan_schedule, + checkout_session_params=checkout_session_params, ) req = self._build_request( @@ -491,6 +800,7 @@ class Billing(BaseSDK): success_url: Optional[str] = None, new_billing_subscription: Optional[bool] = None, plan_schedule: Optional[models.PreviewAttachPlanSchedule] = None, + checkout_session_params: Optional[Dict[str, Any]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -512,6 +822,7 @@ class Billing(BaseSDK): :param success_url: URL to redirect to after successful checkout. :param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. :param plan_schedule: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + :param checkout_session_params: Additional parameters to pass into the creation of the Stripe 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 @@ -548,6 +859,7 @@ class Billing(BaseSDK): success_url=success_url, new_billing_subscription=new_billing_subscription, plan_schedule=plan_schedule, + checkout_session_params=checkout_session_params, ) req = self._build_request_async( @@ -609,6 +921,326 @@ class Billing(BaseSDK): raise errors.AutumnDefaultError("Unexpected response received", http_res) + def preview_multi_attach( + self, + *, + customer_id: str, + plans: Union[ + List[models.PreviewMultiAttachPlan], + List[models.PreviewMultiAttachPlanTypedDict], + ], + entity_id: Optional[str] = None, + free_trial: OptionalNullable[ + Union[ + models.PreviewMultiAttachFreeTrialParams, + models.PreviewMultiAttachFreeTrialParamsTypedDict, + ] + ] = UNSET, + invoice_mode: Optional[ + Union[ + models.PreviewMultiAttachInvoiceMode, + models.PreviewMultiAttachInvoiceModeTypedDict, + ] + ] = None, + discounts: Optional[ + Union[ + List[models.PreviewMultiAttachAttachDiscount], + List[models.PreviewMultiAttachAttachDiscountTypedDict], + ] + ] = None, + success_url: Optional[str] = None, + checkout_session_params: Optional[Dict[str, Any]] = None, + redirect_mode: Optional[models.PreviewMultiAttachRedirectMode] = "if_required", + new_billing_subscription: Optional[bool] = None, + customer_data: Optional[ + Union[models.CustomerData, models.CustomerDataTypedDict] + ] = None, + entity_data: Optional[ + Union[ + models.PreviewMultiAttachEntityData, + models.PreviewMultiAttachEntityDataTypedDict, + ] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.PreviewMultiAttachResponse: + r"""Previews the billing changes that would occur when attaching multiple plans, without actually making any changes. + + Use this endpoint to show customers what they will be charged before confirming a multi-plan subscription. + + :param customer_id: The ID of the customer to attach the plans to. + :param plans: The list of plans to attach to the customer. + :param entity_id: The ID of the entity to attach the plans to. + :param free_trial: Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. + :param invoice_mode: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. + :param discounts: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + :param success_url: URL to redirect to after successful checkout. + :param checkout_session_params: Additional parameters to pass into the creation of the Stripe checkout session. + :param redirect_mode: Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. + :param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + :param customer_data: Customer details to set when creating a customer + :param entity_data: + :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.PreviewMultiAttachParams( + customer_id=customer_id, + entity_id=entity_id, + plans=utils.get_pydantic_model(plans, List[models.PreviewMultiAttachPlan]), + free_trial=utils.get_pydantic_model( + free_trial, OptionalNullable[models.PreviewMultiAttachFreeTrialParams] + ), + invoice_mode=utils.get_pydantic_model( + invoice_mode, Optional[models.PreviewMultiAttachInvoiceMode] + ), + discounts=utils.get_pydantic_model( + discounts, Optional[List[models.PreviewMultiAttachAttachDiscount]] + ), + success_url=success_url, + checkout_session_params=checkout_session_params, + redirect_mode=redirect_mode, + new_billing_subscription=new_billing_subscription, + customer_data=utils.get_pydantic_model( + customer_data, Optional[models.CustomerData] + ), + entity_data=utils.get_pydantic_model( + entity_data, Optional[models.PreviewMultiAttachEntityData] + ), + ) + + req = self._build_request( + method="POST", + path="/v1/billing.preview_multi_attach", + 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.PreviewMultiAttachGlobals( + 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.PreviewMultiAttachParams + ), + 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="previewMultiAttach", + 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.PreviewMultiAttachResponse, 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 preview_multi_attach_async( + self, + *, + customer_id: str, + plans: Union[ + List[models.PreviewMultiAttachPlan], + List[models.PreviewMultiAttachPlanTypedDict], + ], + entity_id: Optional[str] = None, + free_trial: OptionalNullable[ + Union[ + models.PreviewMultiAttachFreeTrialParams, + models.PreviewMultiAttachFreeTrialParamsTypedDict, + ] + ] = UNSET, + invoice_mode: Optional[ + Union[ + models.PreviewMultiAttachInvoiceMode, + models.PreviewMultiAttachInvoiceModeTypedDict, + ] + ] = None, + discounts: Optional[ + Union[ + List[models.PreviewMultiAttachAttachDiscount], + List[models.PreviewMultiAttachAttachDiscountTypedDict], + ] + ] = None, + success_url: Optional[str] = None, + checkout_session_params: Optional[Dict[str, Any]] = None, + redirect_mode: Optional[models.PreviewMultiAttachRedirectMode] = "if_required", + new_billing_subscription: Optional[bool] = None, + customer_data: Optional[ + Union[models.CustomerData, models.CustomerDataTypedDict] + ] = None, + entity_data: Optional[ + Union[ + models.PreviewMultiAttachEntityData, + models.PreviewMultiAttachEntityDataTypedDict, + ] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.PreviewMultiAttachResponse: + r"""Previews the billing changes that would occur when attaching multiple plans, without actually making any changes. + + Use this endpoint to show customers what they will be charged before confirming a multi-plan subscription. + + :param customer_id: The ID of the customer to attach the plans to. + :param plans: The list of plans to attach to the customer. + :param entity_id: The ID of the entity to attach the plans to. + :param free_trial: Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. + :param invoice_mode: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. + :param discounts: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + :param success_url: URL to redirect to after successful checkout. + :param checkout_session_params: Additional parameters to pass into the creation of the Stripe checkout session. + :param redirect_mode: Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. + :param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + :param customer_data: Customer details to set when creating a customer + :param entity_data: + :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.PreviewMultiAttachParams( + customer_id=customer_id, + entity_id=entity_id, + plans=utils.get_pydantic_model(plans, List[models.PreviewMultiAttachPlan]), + free_trial=utils.get_pydantic_model( + free_trial, OptionalNullable[models.PreviewMultiAttachFreeTrialParams] + ), + invoice_mode=utils.get_pydantic_model( + invoice_mode, Optional[models.PreviewMultiAttachInvoiceMode] + ), + discounts=utils.get_pydantic_model( + discounts, Optional[List[models.PreviewMultiAttachAttachDiscount]] + ), + success_url=success_url, + checkout_session_params=checkout_session_params, + redirect_mode=redirect_mode, + new_billing_subscription=new_billing_subscription, + customer_data=utils.get_pydantic_model( + customer_data, Optional[models.CustomerData] + ), + entity_data=utils.get_pydantic_model( + entity_data, Optional[models.PreviewMultiAttachEntityData] + ), + ) + + req = self._build_request_async( + method="POST", + path="/v1/billing.preview_multi_attach", + 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.PreviewMultiAttachGlobals( + 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.PreviewMultiAttachParams + ), + 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="previewMultiAttach", + 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.PreviewMultiAttachResponse, 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 update( self, *, @@ -1341,10 +1973,26 @@ class Billing(BaseSDK): self, *, customer_id: str, - success_url: Optional[str] = None, - customer_data: Optional[ - Union[models.CustomerData, models.CustomerDataTypedDict] + entity_id: Optional[str] = None, + plan_id: Optional[str] = None, + feature_quantities: Optional[ + Union[ + List[models.SetupPaymentFeatureQuantity], + List[models.SetupPaymentFeatureQuantityTypedDict], + ] ] = None, + version: Optional[float] = None, + customize: Optional[ + Union[models.SetupPaymentCustomize, models.SetupPaymentCustomizeTypedDict] + ] = None, + proration_behavior: Optional[models.SetupPaymentProrationBehavior] = None, + discounts: Optional[ + Union[ + List[models.SetupPaymentAttachDiscount], + List[models.SetupPaymentAttachDiscountTypedDict], + ] + ] = None, + success_url: Optional[str] = None, checkout_session_params: Optional[Dict[str, Any]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -1353,10 +2001,16 @@ class Billing(BaseSDK): ) -> 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 customer_id: The ID of the customer to attach the plan to. + :param entity_id: The ID of the entity to attach the plan to. + :param plan_id: If specified, the plan will be attached to the customer after setup. + :param feature_quantities: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. + :param version: The version of the plan to attach. + :param customize: Customize the plan to attach. Can override the price, items, free trial, or a combination. + :param proration_behavior: How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. + :param discounts: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + :param success_url: URL to redirect to after successful checkout. + :param checkout_session_params: Additional parameters to pass into the creation of the Stripe 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 @@ -1374,10 +2028,20 @@ class Billing(BaseSDK): request = models.SetupPaymentParams( customer_id=customer_id, - success_url=success_url, - customer_data=utils.get_pydantic_model( - customer_data, Optional[models.CustomerData] + entity_id=entity_id, + plan_id=plan_id, + feature_quantities=utils.get_pydantic_model( + feature_quantities, Optional[List[models.SetupPaymentFeatureQuantity]] ), + version=version, + customize=utils.get_pydantic_model( + customize, Optional[models.SetupPaymentCustomize] + ), + proration_behavior=proration_behavior, + discounts=utils.get_pydantic_model( + discounts, Optional[List[models.SetupPaymentAttachDiscount]] + ), + success_url=success_url, checkout_session_params=checkout_session_params, ) @@ -1444,10 +2108,26 @@ class Billing(BaseSDK): self, *, customer_id: str, - success_url: Optional[str] = None, - customer_data: Optional[ - Union[models.CustomerData, models.CustomerDataTypedDict] + entity_id: Optional[str] = None, + plan_id: Optional[str] = None, + feature_quantities: Optional[ + Union[ + List[models.SetupPaymentFeatureQuantity], + List[models.SetupPaymentFeatureQuantityTypedDict], + ] ] = None, + version: Optional[float] = None, + customize: Optional[ + Union[models.SetupPaymentCustomize, models.SetupPaymentCustomizeTypedDict] + ] = None, + proration_behavior: Optional[models.SetupPaymentProrationBehavior] = None, + discounts: Optional[ + Union[ + List[models.SetupPaymentAttachDiscount], + List[models.SetupPaymentAttachDiscountTypedDict], + ] + ] = None, + success_url: Optional[str] = None, checkout_session_params: Optional[Dict[str, Any]] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -1456,10 +2136,16 @@ class Billing(BaseSDK): ) -> 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 customer_id: The ID of the customer to attach the plan to. + :param entity_id: The ID of the entity to attach the plan to. + :param plan_id: If specified, the plan will be attached to the customer after setup. + :param feature_quantities: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. + :param version: The version of the plan to attach. + :param customize: Customize the plan to attach. Can override the price, items, free trial, or a combination. + :param proration_behavior: How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. + :param discounts: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + :param success_url: URL to redirect to after successful checkout. + :param checkout_session_params: Additional parameters to pass into the creation of the Stripe 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 @@ -1477,10 +2163,20 @@ class Billing(BaseSDK): request = models.SetupPaymentParams( customer_id=customer_id, - success_url=success_url, - customer_data=utils.get_pydantic_model( - customer_data, Optional[models.CustomerData] + entity_id=entity_id, + plan_id=plan_id, + feature_quantities=utils.get_pydantic_model( + feature_quantities, Optional[List[models.SetupPaymentFeatureQuantity]] ), + version=version, + customize=utils.get_pydantic_model( + customize, Optional[models.SetupPaymentCustomize] + ), + proration_behavior=proration_behavior, + discounts=utils.get_pydantic_model( + discounts, Optional[List[models.SetupPaymentAttachDiscount]] + ), + success_url=success_url, checkout_session_params=checkout_session_params, ) diff --git a/others/python-sdk/src/autumn_sdk/models/__init__.py b/others/python-sdk/src/autumn_sdk/models/__init__.py index f928e1235..f7ee582d0 100644 --- a/others/python-sdk/src/autumn_sdk/models/__init__.py +++ b/others/python-sdk/src/autumn_sdk/models/__init__.py @@ -24,6 +24,56 @@ if TYPE_CHECKING: Total, TotalTypedDict, ) + from .attachop import ( + AttachAttachDiscount, + AttachAttachDiscountTypedDict, + AttachBasePrice, + AttachBasePriceTypedDict, + AttachBillingMethod, + AttachCode, + AttachCustomize, + AttachCustomizeTypedDict, + AttachDurationType, + AttachExpiryDurationType, + AttachFeatureQuantity, + AttachFeatureQuantityTypedDict, + AttachFreeTrialParams, + AttachFreeTrialParamsTypedDict, + AttachGlobals, + AttachGlobalsTypedDict, + AttachInvoice, + AttachInvoiceMode, + AttachInvoiceModeTypedDict, + AttachInvoiceTypedDict, + AttachItemPriceInterval, + AttachOnDecrease, + AttachOnIncrease, + AttachParams, + AttachParamsTypedDict, + AttachPlanItem, + AttachPlanItemTypedDict, + AttachPlanSchedule, + AttachPrice, + AttachPriceInterval, + AttachPriceTypedDict, + AttachProration, + AttachProrationBehavior, + AttachProrationTypedDict, + AttachRequiredAction, + AttachRequiredActionTypedDict, + AttachReset, + AttachResetInterval, + AttachResetTypedDict, + AttachResponse, + AttachResponseTypedDict, + AttachRollover, + AttachRolloverTypedDict, + AttachTier, + AttachTierBehavior, + AttachTierTypedDict, + AttachTo, + AttachToTypedDict, + ) from .balance import ( Balance, BalanceBillingMethod, @@ -41,6 +91,7 @@ if TYPE_CHECKING: BalanceRollover, BalanceRolloverTypedDict, BalanceTier, + BalanceTierBehavior, BalanceTierTypedDict, BalanceTo, BalanceToTypedDict, @@ -51,55 +102,6 @@ if TYPE_CHECKING: Interval, IntervalTypedDict, ) - from .billingattachop import ( - AttachParams, - AttachParamsTypedDict, - BillingAttachAttachDiscount, - BillingAttachAttachDiscountTypedDict, - BillingAttachBasePrice, - BillingAttachBasePriceTypedDict, - BillingAttachBillingMethod, - BillingAttachCode, - BillingAttachCustomize, - BillingAttachCustomizeTypedDict, - BillingAttachDurationType, - BillingAttachExpiryDurationType, - BillingAttachFeatureQuantity, - BillingAttachFeatureQuantityTypedDict, - BillingAttachFreeTrialParams, - BillingAttachFreeTrialParamsTypedDict, - BillingAttachGlobals, - BillingAttachGlobalsTypedDict, - BillingAttachInvoice, - BillingAttachInvoiceMode, - BillingAttachInvoiceModeTypedDict, - BillingAttachInvoiceTypedDict, - BillingAttachItemPriceInterval, - BillingAttachOnDecrease, - BillingAttachOnIncrease, - BillingAttachPlanItem, - BillingAttachPlanItemTypedDict, - BillingAttachPlanSchedule, - BillingAttachPrice, - BillingAttachPriceInterval, - BillingAttachPriceTypedDict, - BillingAttachProration, - BillingAttachProrationBehavior, - BillingAttachProrationTypedDict, - BillingAttachRequiredAction, - BillingAttachRequiredActionTypedDict, - BillingAttachReset, - BillingAttachResetInterval, - BillingAttachResetTypedDict, - BillingAttachResponse, - BillingAttachResponseTypedDict, - BillingAttachRollover, - BillingAttachRolloverTypedDict, - BillingAttachTier, - BillingAttachTierTypedDict, - BillingAttachTo, - BillingAttachToTypedDict, - ) from .billingupdateop import ( BillingUpdateBasePrice, BillingUpdateBasePriceTypedDict, @@ -141,6 +143,7 @@ if TYPE_CHECKING: BillingUpdateRollover, BillingUpdateRolloverTypedDict, BillingUpdateTier, + BillingUpdateTierBehavior, BillingUpdateTierTypedDict, BillingUpdateTo, BillingUpdateToTypedDict, @@ -168,6 +171,8 @@ if TYPE_CHECKING: CheckResponseTypedDict, CheckRollover, CheckRolloverTypedDict, + CheckScenario, + CheckTierBehavior, CheckTo, CheckToTypedDict, CheckType, @@ -183,7 +188,6 @@ if TYPE_CHECKING: ProductScenario, ProductTypedDict, RolloverDuration, - Scenario, Tiers, TiersTypedDict, UsageModel, @@ -238,6 +242,8 @@ if TYPE_CHECKING: CreatePlanBillingMethodResponse, CreatePlanCreditSchema, CreatePlanCreditSchemaTypedDict, + CreatePlanCustomerEligibility, + CreatePlanCustomerEligibilityTypedDict, CreatePlanDurationTypeRequest, CreatePlanDurationTypeResponse, CreatePlanEnv, @@ -289,6 +295,9 @@ if TYPE_CHECKING: CreatePlanRolloverRequestTypedDict, CreatePlanRolloverResponse, CreatePlanRolloverResponseTypedDict, + CreatePlanScenario, + CreatePlanTierBehaviorRequest, + CreatePlanTierBehaviorResponse, CreatePlanTierRequest, CreatePlanTierRequestTypedDict, CreatePlanTierResponse, @@ -409,6 +418,8 @@ if TYPE_CHECKING: GetPlanBillingMethod, GetPlanCreditSchema, GetPlanCreditSchemaTypedDict, + GetPlanCustomerEligibility, + GetPlanCustomerEligibilityTypedDict, GetPlanDurationType, GetPlanEnv, GetPlanExpiryDurationType, @@ -441,7 +452,9 @@ if TYPE_CHECKING: GetPlanResponseTypedDict, GetPlanRollover, GetPlanRolloverTypedDict, + GetPlanScenario, GetPlanTier, + GetPlanTierBehavior, GetPlanTierTypedDict, GetPlanTo, GetPlanToTypedDict, @@ -501,6 +514,8 @@ if TYPE_CHECKING: ListPlansBillingMethod, ListPlansCreditSchema, ListPlansCreditSchemaTypedDict, + ListPlansCustomerEligibility, + ListPlansCustomerEligibilityTypedDict, ListPlansDurationType, ListPlansEnv, ListPlansExpiryDurationType, @@ -535,12 +550,67 @@ if TYPE_CHECKING: ListPlansResponseTypedDict, ListPlansRollover, ListPlansRolloverTypedDict, + ListPlansScenario, ListPlansTier, + ListPlansTierBehavior, ListPlansTierTypedDict, ListPlansTo, ListPlansToTypedDict, ListPlansType, ) + from .multiattachop import ( + MultiAttachAttachDiscount, + MultiAttachAttachDiscountTypedDict, + MultiAttachBasePrice, + MultiAttachBasePriceTypedDict, + MultiAttachBillingMethod, + MultiAttachCode, + MultiAttachCustomize, + MultiAttachCustomizeTypedDict, + MultiAttachDurationType, + MultiAttachEntityData, + MultiAttachEntityDataTypedDict, + MultiAttachExpiryDurationType, + MultiAttachFeatureQuantity, + MultiAttachFeatureQuantityTypedDict, + MultiAttachFreeTrialParams, + MultiAttachFreeTrialParamsTypedDict, + MultiAttachGlobals, + MultiAttachGlobalsTypedDict, + MultiAttachInvoice, + MultiAttachInvoiceMode, + MultiAttachInvoiceModeTypedDict, + MultiAttachInvoiceTypedDict, + MultiAttachItemPriceInterval, + MultiAttachOnDecrease, + MultiAttachOnIncrease, + MultiAttachParams, + MultiAttachParamsTypedDict, + MultiAttachPlan, + MultiAttachPlanItem, + MultiAttachPlanItemTypedDict, + MultiAttachPlanTypedDict, + MultiAttachPrice, + MultiAttachPriceInterval, + MultiAttachPriceTypedDict, + MultiAttachProration, + MultiAttachProrationTypedDict, + MultiAttachRedirectMode, + MultiAttachRequiredAction, + MultiAttachRequiredActionTypedDict, + MultiAttachReset, + MultiAttachResetInterval, + MultiAttachResetTypedDict, + MultiAttachResponse, + MultiAttachResponseTypedDict, + MultiAttachRollover, + MultiAttachRolloverTypedDict, + MultiAttachTier, + MultiAttachTierBehavior, + MultiAttachTierTypedDict, + MultiAttachTo, + MultiAttachToTypedDict, + ) from .opencustomerportalop import ( OpenCustomerPortalGlobals, OpenCustomerPortalGlobalsTypedDict, @@ -550,6 +620,8 @@ if TYPE_CHECKING: OpenCustomerPortalResponseTypedDict, ) from .plan import ( + CustomerEligibility, + CustomerEligibilityTypedDict, ExpiryDurationType, FreeTrial, FreeTrialTypedDict, @@ -581,11 +653,13 @@ if TYPE_CHECKING: PlanRollover, PlanRolloverTypedDict, PlanTier, + PlanTierBehavior, PlanTierTypedDict, PlanTo, PlanToTypedDict, PlanType, PlanTypedDict, + Scenario, ) from .previewattachop import ( PreviewAttachAttachDiscount, @@ -633,10 +707,65 @@ if TYPE_CHECKING: PreviewAttachRollover, PreviewAttachRolloverTypedDict, PreviewAttachTier, + PreviewAttachTierBehavior, PreviewAttachTierTypedDict, PreviewAttachTo, PreviewAttachToTypedDict, ) + from .previewmultiattachop import ( + PreviewMultiAttachAttachDiscount, + PreviewMultiAttachAttachDiscountTypedDict, + PreviewMultiAttachBasePrice, + PreviewMultiAttachBasePriceTypedDict, + PreviewMultiAttachBillingMethod, + PreviewMultiAttachCustomize, + PreviewMultiAttachCustomizeTypedDict, + PreviewMultiAttachDiscount, + PreviewMultiAttachDiscountTypedDict, + PreviewMultiAttachDurationType, + PreviewMultiAttachEntityData, + PreviewMultiAttachEntityDataTypedDict, + PreviewMultiAttachExpiryDurationType, + PreviewMultiAttachFeatureQuantity, + PreviewMultiAttachFeatureQuantityTypedDict, + PreviewMultiAttachFreeTrialParams, + PreviewMultiAttachFreeTrialParamsTypedDict, + PreviewMultiAttachGlobals, + PreviewMultiAttachGlobalsTypedDict, + PreviewMultiAttachInvoiceMode, + PreviewMultiAttachInvoiceModeTypedDict, + PreviewMultiAttachItemPriceInterval, + PreviewMultiAttachLineItem, + PreviewMultiAttachLineItemTypedDict, + PreviewMultiAttachNextCycle, + PreviewMultiAttachNextCycleTypedDict, + PreviewMultiAttachOnDecrease, + PreviewMultiAttachOnIncrease, + PreviewMultiAttachParams, + PreviewMultiAttachParamsTypedDict, + PreviewMultiAttachPlan, + PreviewMultiAttachPlanItem, + PreviewMultiAttachPlanItemTypedDict, + PreviewMultiAttachPlanTypedDict, + PreviewMultiAttachPrice, + PreviewMultiAttachPriceInterval, + PreviewMultiAttachPriceTypedDict, + PreviewMultiAttachProration, + PreviewMultiAttachProrationTypedDict, + PreviewMultiAttachRedirectMode, + PreviewMultiAttachReset, + PreviewMultiAttachResetInterval, + PreviewMultiAttachResetTypedDict, + PreviewMultiAttachResponse, + PreviewMultiAttachResponseTypedDict, + PreviewMultiAttachRollover, + PreviewMultiAttachRolloverTypedDict, + PreviewMultiAttachTier, + PreviewMultiAttachTierBehavior, + PreviewMultiAttachTierTypedDict, + PreviewMultiAttachTo, + PreviewMultiAttachToTypedDict, + ) from .previewupdateop import ( PreviewUpdateBasePrice, PreviewUpdateBasePriceTypedDict, @@ -681,6 +810,7 @@ if TYPE_CHECKING: PreviewUpdateRollover, PreviewUpdateRolloverTypedDict, PreviewUpdateTier, + PreviewUpdateTierBehavior, PreviewUpdateTierTypedDict, PreviewUpdateTo, PreviewUpdateToTypedDict, @@ -695,12 +825,46 @@ if TYPE_CHECKING: ) from .security import Security, SecurityTypedDict from .setuppaymentop import ( + SetupPaymentAttachDiscount, + SetupPaymentAttachDiscountTypedDict, + SetupPaymentBasePrice, + SetupPaymentBasePriceTypedDict, + SetupPaymentBillingMethod, + SetupPaymentCustomize, + SetupPaymentCustomizeTypedDict, + SetupPaymentDurationType, + SetupPaymentExpiryDurationType, + SetupPaymentFeatureQuantity, + SetupPaymentFeatureQuantityTypedDict, + SetupPaymentFreeTrialParams, + SetupPaymentFreeTrialParamsTypedDict, SetupPaymentGlobals, SetupPaymentGlobalsTypedDict, + SetupPaymentItemPriceInterval, + SetupPaymentOnDecrease, + SetupPaymentOnIncrease, SetupPaymentParams, SetupPaymentParamsTypedDict, + SetupPaymentPlanItem, + SetupPaymentPlanItemTypedDict, + SetupPaymentPrice, + SetupPaymentPriceInterval, + SetupPaymentPriceTypedDict, + SetupPaymentProration, + SetupPaymentProrationBehavior, + SetupPaymentProrationTypedDict, + SetupPaymentReset, + SetupPaymentResetInterval, + SetupPaymentResetTypedDict, SetupPaymentResponse, SetupPaymentResponseTypedDict, + SetupPaymentRollover, + SetupPaymentRolloverTypedDict, + SetupPaymentTier, + SetupPaymentTierBehavior, + SetupPaymentTierTypedDict, + SetupPaymentTo, + SetupPaymentToTypedDict, ) from .trackop import ( TrackGlobals, @@ -758,6 +922,8 @@ if TYPE_CHECKING: UpdatePlanBillingMethodResponse, UpdatePlanCreditSchema, UpdatePlanCreditSchemaTypedDict, + UpdatePlanCustomerEligibility, + UpdatePlanCustomerEligibilityTypedDict, UpdatePlanDurationTypeRequest, UpdatePlanDurationTypeResponse, UpdatePlanEnv, @@ -809,6 +975,9 @@ if TYPE_CHECKING: UpdatePlanRolloverRequestTypedDict, UpdatePlanRolloverResponse, UpdatePlanRolloverResponseTypedDict, + UpdatePlanScenario, + UpdatePlanTierBehaviorRequest, + UpdatePlanTierBehaviorResponse, UpdatePlanTierRequest, UpdatePlanTierRequestTypedDict, UpdatePlanTierResponse, @@ -831,8 +1000,54 @@ __all__ = [ "AggregateEventsListTypedDict", "AggregateEventsResponse", "AggregateEventsResponseTypedDict", + "AttachAttachDiscount", + "AttachAttachDiscountTypedDict", + "AttachBasePrice", + "AttachBasePriceTypedDict", + "AttachBillingMethod", + "AttachCode", + "AttachCustomize", + "AttachCustomizeTypedDict", + "AttachDurationType", + "AttachExpiryDurationType", + "AttachFeatureQuantity", + "AttachFeatureQuantityTypedDict", + "AttachFreeTrialParams", + "AttachFreeTrialParamsTypedDict", + "AttachGlobals", + "AttachGlobalsTypedDict", + "AttachInvoice", + "AttachInvoiceMode", + "AttachInvoiceModeTypedDict", + "AttachInvoiceTypedDict", + "AttachItemPriceInterval", + "AttachOnDecrease", + "AttachOnIncrease", "AttachParams", "AttachParamsTypedDict", + "AttachPlanItem", + "AttachPlanItemTypedDict", + "AttachPlanSchedule", + "AttachPrice", + "AttachPriceInterval", + "AttachPriceTypedDict", + "AttachProration", + "AttachProrationBehavior", + "AttachProrationTypedDict", + "AttachRequiredAction", + "AttachRequiredActionTypedDict", + "AttachReset", + "AttachResetInterval", + "AttachResetTypedDict", + "AttachResponse", + "AttachResponseTypedDict", + "AttachRollover", + "AttachRolloverTypedDict", + "AttachTier", + "AttachTierBehavior", + "AttachTierTypedDict", + "AttachTo", + "AttachToTypedDict", "Balance", "BalanceBillingMethod", "BalanceCreditSchema", @@ -849,56 +1064,12 @@ __all__ = [ "BalanceRollover", "BalanceRolloverTypedDict", "BalanceTier", + "BalanceTierBehavior", "BalanceTierTypedDict", "BalanceTo", "BalanceToTypedDict", "BalanceType", "BalanceTypedDict", - "BillingAttachAttachDiscount", - "BillingAttachAttachDiscountTypedDict", - "BillingAttachBasePrice", - "BillingAttachBasePriceTypedDict", - "BillingAttachBillingMethod", - "BillingAttachCode", - "BillingAttachCustomize", - "BillingAttachCustomizeTypedDict", - "BillingAttachDurationType", - "BillingAttachExpiryDurationType", - "BillingAttachFeatureQuantity", - "BillingAttachFeatureQuantityTypedDict", - "BillingAttachFreeTrialParams", - "BillingAttachFreeTrialParamsTypedDict", - "BillingAttachGlobals", - "BillingAttachGlobalsTypedDict", - "BillingAttachInvoice", - "BillingAttachInvoiceMode", - "BillingAttachInvoiceModeTypedDict", - "BillingAttachInvoiceTypedDict", - "BillingAttachItemPriceInterval", - "BillingAttachOnDecrease", - "BillingAttachOnIncrease", - "BillingAttachPlanItem", - "BillingAttachPlanItemTypedDict", - "BillingAttachPlanSchedule", - "BillingAttachPrice", - "BillingAttachPriceInterval", - "BillingAttachPriceTypedDict", - "BillingAttachProration", - "BillingAttachProrationBehavior", - "BillingAttachProrationTypedDict", - "BillingAttachRequiredAction", - "BillingAttachRequiredActionTypedDict", - "BillingAttachReset", - "BillingAttachResetInterval", - "BillingAttachResetTypedDict", - "BillingAttachResponse", - "BillingAttachResponseTypedDict", - "BillingAttachRollover", - "BillingAttachRolloverTypedDict", - "BillingAttachTier", - "BillingAttachTierTypedDict", - "BillingAttachTo", - "BillingAttachToTypedDict", "BillingUpdateBasePrice", "BillingUpdateBasePriceTypedDict", "BillingUpdateBillingMethod", @@ -939,6 +1110,7 @@ __all__ = [ "BillingUpdateRollover", "BillingUpdateRolloverTypedDict", "BillingUpdateTier", + "BillingUpdateTierBehavior", "BillingUpdateTierTypedDict", "BillingUpdateTo", "BillingUpdateToTypedDict", @@ -965,6 +1137,8 @@ __all__ = [ "CheckResponseTypedDict", "CheckRollover", "CheckRolloverTypedDict", + "CheckScenario", + "CheckTierBehavior", "CheckTo", "CheckToTypedDict", "CheckType", @@ -1013,6 +1187,8 @@ __all__ = [ "CreatePlanBillingMethodResponse", "CreatePlanCreditSchema", "CreatePlanCreditSchemaTypedDict", + "CreatePlanCustomerEligibility", + "CreatePlanCustomerEligibilityTypedDict", "CreatePlanDurationTypeRequest", "CreatePlanDurationTypeResponse", "CreatePlanEnv", @@ -1064,6 +1240,9 @@ __all__ = [ "CreatePlanRolloverRequestTypedDict", "CreatePlanRolloverResponse", "CreatePlanRolloverResponseTypedDict", + "CreatePlanScenario", + "CreatePlanTierBehaviorRequest", + "CreatePlanTierBehaviorResponse", "CreatePlanTierRequest", "CreatePlanTierRequestTypedDict", "CreatePlanTierResponse", @@ -1083,6 +1262,8 @@ __all__ = [ "CustomerData", "CustomerDataTypedDict", "CustomerDurationType", + "CustomerEligibility", + "CustomerEligibilityTypedDict", "CustomerEnv", "CustomerExpand", "CustomerType", @@ -1159,6 +1340,8 @@ __all__ = [ "GetPlanBillingMethod", "GetPlanCreditSchema", "GetPlanCreditSchemaTypedDict", + "GetPlanCustomerEligibility", + "GetPlanCustomerEligibilityTypedDict", "GetPlanDurationType", "GetPlanEnv", "GetPlanExpiryDurationType", @@ -1191,7 +1374,9 @@ __all__ = [ "GetPlanResponseTypedDict", "GetPlanRollover", "GetPlanRolloverTypedDict", + "GetPlanScenario", "GetPlanTier", + "GetPlanTierBehavior", "GetPlanTierTypedDict", "GetPlanTo", "GetPlanToTypedDict", @@ -1248,6 +1433,8 @@ __all__ = [ "ListPlansBillingMethod", "ListPlansCreditSchema", "ListPlansCreditSchemaTypedDict", + "ListPlansCustomerEligibility", + "ListPlansCustomerEligibilityTypedDict", "ListPlansDurationType", "ListPlansEnv", "ListPlansExpiryDurationType", @@ -1282,11 +1469,64 @@ __all__ = [ "ListPlansResponseTypedDict", "ListPlansRollover", "ListPlansRolloverTypedDict", + "ListPlansScenario", "ListPlansTier", + "ListPlansTierBehavior", "ListPlansTierTypedDict", "ListPlansTo", "ListPlansToTypedDict", "ListPlansType", + "MultiAttachAttachDiscount", + "MultiAttachAttachDiscountTypedDict", + "MultiAttachBasePrice", + "MultiAttachBasePriceTypedDict", + "MultiAttachBillingMethod", + "MultiAttachCode", + "MultiAttachCustomize", + "MultiAttachCustomizeTypedDict", + "MultiAttachDurationType", + "MultiAttachEntityData", + "MultiAttachEntityDataTypedDict", + "MultiAttachExpiryDurationType", + "MultiAttachFeatureQuantity", + "MultiAttachFeatureQuantityTypedDict", + "MultiAttachFreeTrialParams", + "MultiAttachFreeTrialParamsTypedDict", + "MultiAttachGlobals", + "MultiAttachGlobalsTypedDict", + "MultiAttachInvoice", + "MultiAttachInvoiceMode", + "MultiAttachInvoiceModeTypedDict", + "MultiAttachInvoiceTypedDict", + "MultiAttachItemPriceInterval", + "MultiAttachOnDecrease", + "MultiAttachOnIncrease", + "MultiAttachParams", + "MultiAttachParamsTypedDict", + "MultiAttachPlan", + "MultiAttachPlanItem", + "MultiAttachPlanItemTypedDict", + "MultiAttachPlanTypedDict", + "MultiAttachPrice", + "MultiAttachPriceInterval", + "MultiAttachPriceTypedDict", + "MultiAttachProration", + "MultiAttachProrationTypedDict", + "MultiAttachRedirectMode", + "MultiAttachRequiredAction", + "MultiAttachRequiredActionTypedDict", + "MultiAttachReset", + "MultiAttachResetInterval", + "MultiAttachResetTypedDict", + "MultiAttachResponse", + "MultiAttachResponseTypedDict", + "MultiAttachRollover", + "MultiAttachRolloverTypedDict", + "MultiAttachTier", + "MultiAttachTierBehavior", + "MultiAttachTierTypedDict", + "MultiAttachTo", + "MultiAttachToTypedDict", "OpenCustomerPortalGlobals", "OpenCustomerPortalGlobalsTypedDict", "OpenCustomerPortalParams", @@ -1319,6 +1559,7 @@ __all__ = [ "PlanRollover", "PlanRolloverTypedDict", "PlanTier", + "PlanTierBehavior", "PlanTierTypedDict", "PlanTo", "PlanToTypedDict", @@ -1370,9 +1611,62 @@ __all__ = [ "PreviewAttachRollover", "PreviewAttachRolloverTypedDict", "PreviewAttachTier", + "PreviewAttachTierBehavior", "PreviewAttachTierTypedDict", "PreviewAttachTo", "PreviewAttachToTypedDict", + "PreviewMultiAttachAttachDiscount", + "PreviewMultiAttachAttachDiscountTypedDict", + "PreviewMultiAttachBasePrice", + "PreviewMultiAttachBasePriceTypedDict", + "PreviewMultiAttachBillingMethod", + "PreviewMultiAttachCustomize", + "PreviewMultiAttachCustomizeTypedDict", + "PreviewMultiAttachDiscount", + "PreviewMultiAttachDiscountTypedDict", + "PreviewMultiAttachDurationType", + "PreviewMultiAttachEntityData", + "PreviewMultiAttachEntityDataTypedDict", + "PreviewMultiAttachExpiryDurationType", + "PreviewMultiAttachFeatureQuantity", + "PreviewMultiAttachFeatureQuantityTypedDict", + "PreviewMultiAttachFreeTrialParams", + "PreviewMultiAttachFreeTrialParamsTypedDict", + "PreviewMultiAttachGlobals", + "PreviewMultiAttachGlobalsTypedDict", + "PreviewMultiAttachInvoiceMode", + "PreviewMultiAttachInvoiceModeTypedDict", + "PreviewMultiAttachItemPriceInterval", + "PreviewMultiAttachLineItem", + "PreviewMultiAttachLineItemTypedDict", + "PreviewMultiAttachNextCycle", + "PreviewMultiAttachNextCycleTypedDict", + "PreviewMultiAttachOnDecrease", + "PreviewMultiAttachOnIncrease", + "PreviewMultiAttachParams", + "PreviewMultiAttachParamsTypedDict", + "PreviewMultiAttachPlan", + "PreviewMultiAttachPlanItem", + "PreviewMultiAttachPlanItemTypedDict", + "PreviewMultiAttachPlanTypedDict", + "PreviewMultiAttachPrice", + "PreviewMultiAttachPriceInterval", + "PreviewMultiAttachPriceTypedDict", + "PreviewMultiAttachProration", + "PreviewMultiAttachProrationTypedDict", + "PreviewMultiAttachRedirectMode", + "PreviewMultiAttachReset", + "PreviewMultiAttachResetInterval", + "PreviewMultiAttachResetTypedDict", + "PreviewMultiAttachResponse", + "PreviewMultiAttachResponseTypedDict", + "PreviewMultiAttachRollover", + "PreviewMultiAttachRolloverTypedDict", + "PreviewMultiAttachTier", + "PreviewMultiAttachTierBehavior", + "PreviewMultiAttachTierTypedDict", + "PreviewMultiAttachTo", + "PreviewMultiAttachToTypedDict", "PreviewTypedDict", "PreviewUpdateBasePrice", "PreviewUpdateBasePriceTypedDict", @@ -1417,6 +1711,7 @@ __all__ = [ "PreviewUpdateRollover", "PreviewUpdateRolloverTypedDict", "PreviewUpdateTier", + "PreviewUpdateTierBehavior", "PreviewUpdateTierTypedDict", "PreviewUpdateTo", "PreviewUpdateToTypedDict", @@ -1442,12 +1737,46 @@ __all__ = [ "Scenario", "Security", "SecurityTypedDict", + "SetupPaymentAttachDiscount", + "SetupPaymentAttachDiscountTypedDict", + "SetupPaymentBasePrice", + "SetupPaymentBasePriceTypedDict", + "SetupPaymentBillingMethod", + "SetupPaymentCustomize", + "SetupPaymentCustomizeTypedDict", + "SetupPaymentDurationType", + "SetupPaymentExpiryDurationType", + "SetupPaymentFeatureQuantity", + "SetupPaymentFeatureQuantityTypedDict", + "SetupPaymentFreeTrialParams", + "SetupPaymentFreeTrialParamsTypedDict", "SetupPaymentGlobals", "SetupPaymentGlobalsTypedDict", + "SetupPaymentItemPriceInterval", + "SetupPaymentOnDecrease", + "SetupPaymentOnIncrease", "SetupPaymentParams", "SetupPaymentParamsTypedDict", + "SetupPaymentPlanItem", + "SetupPaymentPlanItemTypedDict", + "SetupPaymentPrice", + "SetupPaymentPriceInterval", + "SetupPaymentPriceTypedDict", + "SetupPaymentProration", + "SetupPaymentProrationBehavior", + "SetupPaymentProrationTypedDict", + "SetupPaymentReset", + "SetupPaymentResetInterval", + "SetupPaymentResetTypedDict", "SetupPaymentResponse", "SetupPaymentResponseTypedDict", + "SetupPaymentRollover", + "SetupPaymentRolloverTypedDict", + "SetupPaymentTier", + "SetupPaymentTierBehavior", + "SetupPaymentTierTypedDict", + "SetupPaymentTo", + "SetupPaymentToTypedDict", "Status", "Subscription", "SubscriptionStatus", @@ -1505,6 +1834,8 @@ __all__ = [ "UpdatePlanBillingMethodResponse", "UpdatePlanCreditSchema", "UpdatePlanCreditSchemaTypedDict", + "UpdatePlanCustomerEligibility", + "UpdatePlanCustomerEligibilityTypedDict", "UpdatePlanDurationTypeRequest", "UpdatePlanDurationTypeResponse", "UpdatePlanEnv", @@ -1556,6 +1887,9 @@ __all__ = [ "UpdatePlanRolloverRequestTypedDict", "UpdatePlanRolloverResponse", "UpdatePlanRolloverResponseTypedDict", + "UpdatePlanScenario", + "UpdatePlanTierBehaviorRequest", + "UpdatePlanTierBehaviorResponse", "UpdatePlanTierRequest", "UpdatePlanTierRequestTypedDict", "UpdatePlanTierResponse", @@ -1587,6 +1921,54 @@ _dynamic_imports: dict[str, str] = { "Range": ".aggregateeventsop", "Total": ".aggregateeventsop", "TotalTypedDict": ".aggregateeventsop", + "AttachAttachDiscount": ".attachop", + "AttachAttachDiscountTypedDict": ".attachop", + "AttachBasePrice": ".attachop", + "AttachBasePriceTypedDict": ".attachop", + "AttachBillingMethod": ".attachop", + "AttachCode": ".attachop", + "AttachCustomize": ".attachop", + "AttachCustomizeTypedDict": ".attachop", + "AttachDurationType": ".attachop", + "AttachExpiryDurationType": ".attachop", + "AttachFeatureQuantity": ".attachop", + "AttachFeatureQuantityTypedDict": ".attachop", + "AttachFreeTrialParams": ".attachop", + "AttachFreeTrialParamsTypedDict": ".attachop", + "AttachGlobals": ".attachop", + "AttachGlobalsTypedDict": ".attachop", + "AttachInvoice": ".attachop", + "AttachInvoiceMode": ".attachop", + "AttachInvoiceModeTypedDict": ".attachop", + "AttachInvoiceTypedDict": ".attachop", + "AttachItemPriceInterval": ".attachop", + "AttachOnDecrease": ".attachop", + "AttachOnIncrease": ".attachop", + "AttachParams": ".attachop", + "AttachParamsTypedDict": ".attachop", + "AttachPlanItem": ".attachop", + "AttachPlanItemTypedDict": ".attachop", + "AttachPlanSchedule": ".attachop", + "AttachPrice": ".attachop", + "AttachPriceInterval": ".attachop", + "AttachPriceTypedDict": ".attachop", + "AttachProration": ".attachop", + "AttachProrationBehavior": ".attachop", + "AttachProrationTypedDict": ".attachop", + "AttachRequiredAction": ".attachop", + "AttachRequiredActionTypedDict": ".attachop", + "AttachReset": ".attachop", + "AttachResetInterval": ".attachop", + "AttachResetTypedDict": ".attachop", + "AttachResponse": ".attachop", + "AttachResponseTypedDict": ".attachop", + "AttachRollover": ".attachop", + "AttachRolloverTypedDict": ".attachop", + "AttachTier": ".attachop", + "AttachTierBehavior": ".attachop", + "AttachTierTypedDict": ".attachop", + "AttachTo": ".attachop", + "AttachToTypedDict": ".attachop", "Balance": ".balance", "BalanceBillingMethod": ".balance", "BalanceCreditSchema": ".balance", @@ -1603,6 +1985,7 @@ _dynamic_imports: dict[str, str] = { "BalanceRollover": ".balance", "BalanceRolloverTypedDict": ".balance", "BalanceTier": ".balance", + "BalanceTierBehavior": ".balance", "BalanceTierTypedDict": ".balance", "BalanceTo": ".balance", "BalanceToTypedDict": ".balance", @@ -1612,53 +1995,6 @@ _dynamic_imports: dict[str, str] = { "BreakdownTypedDict": ".balance", "Interval": ".balance", "IntervalTypedDict": ".balance", - "AttachParams": ".billingattachop", - "AttachParamsTypedDict": ".billingattachop", - "BillingAttachAttachDiscount": ".billingattachop", - "BillingAttachAttachDiscountTypedDict": ".billingattachop", - "BillingAttachBasePrice": ".billingattachop", - "BillingAttachBasePriceTypedDict": ".billingattachop", - "BillingAttachBillingMethod": ".billingattachop", - "BillingAttachCode": ".billingattachop", - "BillingAttachCustomize": ".billingattachop", - "BillingAttachCustomizeTypedDict": ".billingattachop", - "BillingAttachDurationType": ".billingattachop", - "BillingAttachExpiryDurationType": ".billingattachop", - "BillingAttachFeatureQuantity": ".billingattachop", - "BillingAttachFeatureQuantityTypedDict": ".billingattachop", - "BillingAttachFreeTrialParams": ".billingattachop", - "BillingAttachFreeTrialParamsTypedDict": ".billingattachop", - "BillingAttachGlobals": ".billingattachop", - "BillingAttachGlobalsTypedDict": ".billingattachop", - "BillingAttachInvoice": ".billingattachop", - "BillingAttachInvoiceMode": ".billingattachop", - "BillingAttachInvoiceModeTypedDict": ".billingattachop", - "BillingAttachInvoiceTypedDict": ".billingattachop", - "BillingAttachItemPriceInterval": ".billingattachop", - "BillingAttachOnDecrease": ".billingattachop", - "BillingAttachOnIncrease": ".billingattachop", - "BillingAttachPlanItem": ".billingattachop", - "BillingAttachPlanItemTypedDict": ".billingattachop", - "BillingAttachPlanSchedule": ".billingattachop", - "BillingAttachPrice": ".billingattachop", - "BillingAttachPriceInterval": ".billingattachop", - "BillingAttachPriceTypedDict": ".billingattachop", - "BillingAttachProration": ".billingattachop", - "BillingAttachProrationBehavior": ".billingattachop", - "BillingAttachProrationTypedDict": ".billingattachop", - "BillingAttachRequiredAction": ".billingattachop", - "BillingAttachRequiredActionTypedDict": ".billingattachop", - "BillingAttachReset": ".billingattachop", - "BillingAttachResetInterval": ".billingattachop", - "BillingAttachResetTypedDict": ".billingattachop", - "BillingAttachResponse": ".billingattachop", - "BillingAttachResponseTypedDict": ".billingattachop", - "BillingAttachRollover": ".billingattachop", - "BillingAttachRolloverTypedDict": ".billingattachop", - "BillingAttachTier": ".billingattachop", - "BillingAttachTierTypedDict": ".billingattachop", - "BillingAttachTo": ".billingattachop", - "BillingAttachToTypedDict": ".billingattachop", "BillingUpdateBasePrice": ".billingupdateop", "BillingUpdateBasePriceTypedDict": ".billingupdateop", "BillingUpdateBillingMethod": ".billingupdateop", @@ -1699,6 +2035,7 @@ _dynamic_imports: dict[str, str] = { "BillingUpdateRollover": ".billingupdateop", "BillingUpdateRolloverTypedDict": ".billingupdateop", "BillingUpdateTier": ".billingupdateop", + "BillingUpdateTierBehavior": ".billingupdateop", "BillingUpdateTierTypedDict": ".billingupdateop", "BillingUpdateTo": ".billingupdateop", "BillingUpdateToTypedDict": ".billingupdateop", @@ -1724,6 +2061,8 @@ _dynamic_imports: dict[str, str] = { "CheckResponseTypedDict": ".checkop", "CheckRollover": ".checkop", "CheckRolloverTypedDict": ".checkop", + "CheckScenario": ".checkop", + "CheckTierBehavior": ".checkop", "CheckTo": ".checkop", "CheckToTypedDict": ".checkop", "CheckType": ".checkop", @@ -1739,7 +2078,6 @@ _dynamic_imports: dict[str, str] = { "ProductScenario": ".checkop", "ProductTypedDict": ".checkop", "RolloverDuration": ".checkop", - "Scenario": ".checkop", "Tiers": ".checkop", "TiersTypedDict": ".checkop", "UsageModel": ".checkop", @@ -1786,6 +2124,8 @@ _dynamic_imports: dict[str, str] = { "CreatePlanBillingMethodResponse": ".createplanop", "CreatePlanCreditSchema": ".createplanop", "CreatePlanCreditSchemaTypedDict": ".createplanop", + "CreatePlanCustomerEligibility": ".createplanop", + "CreatePlanCustomerEligibilityTypedDict": ".createplanop", "CreatePlanDurationTypeRequest": ".createplanop", "CreatePlanDurationTypeResponse": ".createplanop", "CreatePlanEnv": ".createplanop", @@ -1837,6 +2177,9 @@ _dynamic_imports: dict[str, str] = { "CreatePlanRolloverRequestTypedDict": ".createplanop", "CreatePlanRolloverResponse": ".createplanop", "CreatePlanRolloverResponseTypedDict": ".createplanop", + "CreatePlanScenario": ".createplanop", + "CreatePlanTierBehaviorRequest": ".createplanop", + "CreatePlanTierBehaviorResponse": ".createplanop", "CreatePlanTierRequest": ".createplanop", "CreatePlanTierRequestTypedDict": ".createplanop", "CreatePlanTierResponse": ".createplanop", @@ -1938,6 +2281,8 @@ _dynamic_imports: dict[str, str] = { "GetPlanBillingMethod": ".getplanop", "GetPlanCreditSchema": ".getplanop", "GetPlanCreditSchemaTypedDict": ".getplanop", + "GetPlanCustomerEligibility": ".getplanop", + "GetPlanCustomerEligibilityTypedDict": ".getplanop", "GetPlanDurationType": ".getplanop", "GetPlanEnv": ".getplanop", "GetPlanExpiryDurationType": ".getplanop", @@ -1970,7 +2315,9 @@ _dynamic_imports: dict[str, str] = { "GetPlanResponseTypedDict": ".getplanop", "GetPlanRollover": ".getplanop", "GetPlanRolloverTypedDict": ".getplanop", + "GetPlanScenario": ".getplanop", "GetPlanTier": ".getplanop", + "GetPlanTierBehavior": ".getplanop", "GetPlanTierTypedDict": ".getplanop", "GetPlanTo": ".getplanop", "GetPlanToTypedDict": ".getplanop", @@ -2022,6 +2369,8 @@ _dynamic_imports: dict[str, str] = { "ListPlansBillingMethod": ".listplansop", "ListPlansCreditSchema": ".listplansop", "ListPlansCreditSchemaTypedDict": ".listplansop", + "ListPlansCustomerEligibility": ".listplansop", + "ListPlansCustomerEligibilityTypedDict": ".listplansop", "ListPlansDurationType": ".listplansop", "ListPlansEnv": ".listplansop", "ListPlansExpiryDurationType": ".listplansop", @@ -2056,17 +2405,72 @@ _dynamic_imports: dict[str, str] = { "ListPlansResponseTypedDict": ".listplansop", "ListPlansRollover": ".listplansop", "ListPlansRolloverTypedDict": ".listplansop", + "ListPlansScenario": ".listplansop", "ListPlansTier": ".listplansop", + "ListPlansTierBehavior": ".listplansop", "ListPlansTierTypedDict": ".listplansop", "ListPlansTo": ".listplansop", "ListPlansToTypedDict": ".listplansop", "ListPlansType": ".listplansop", + "MultiAttachAttachDiscount": ".multiattachop", + "MultiAttachAttachDiscountTypedDict": ".multiattachop", + "MultiAttachBasePrice": ".multiattachop", + "MultiAttachBasePriceTypedDict": ".multiattachop", + "MultiAttachBillingMethod": ".multiattachop", + "MultiAttachCode": ".multiattachop", + "MultiAttachCustomize": ".multiattachop", + "MultiAttachCustomizeTypedDict": ".multiattachop", + "MultiAttachDurationType": ".multiattachop", + "MultiAttachEntityData": ".multiattachop", + "MultiAttachEntityDataTypedDict": ".multiattachop", + "MultiAttachExpiryDurationType": ".multiattachop", + "MultiAttachFeatureQuantity": ".multiattachop", + "MultiAttachFeatureQuantityTypedDict": ".multiattachop", + "MultiAttachFreeTrialParams": ".multiattachop", + "MultiAttachFreeTrialParamsTypedDict": ".multiattachop", + "MultiAttachGlobals": ".multiattachop", + "MultiAttachGlobalsTypedDict": ".multiattachop", + "MultiAttachInvoice": ".multiattachop", + "MultiAttachInvoiceMode": ".multiattachop", + "MultiAttachInvoiceModeTypedDict": ".multiattachop", + "MultiAttachInvoiceTypedDict": ".multiattachop", + "MultiAttachItemPriceInterval": ".multiattachop", + "MultiAttachOnDecrease": ".multiattachop", + "MultiAttachOnIncrease": ".multiattachop", + "MultiAttachParams": ".multiattachop", + "MultiAttachParamsTypedDict": ".multiattachop", + "MultiAttachPlan": ".multiattachop", + "MultiAttachPlanItem": ".multiattachop", + "MultiAttachPlanItemTypedDict": ".multiattachop", + "MultiAttachPlanTypedDict": ".multiattachop", + "MultiAttachPrice": ".multiattachop", + "MultiAttachPriceInterval": ".multiattachop", + "MultiAttachPriceTypedDict": ".multiattachop", + "MultiAttachProration": ".multiattachop", + "MultiAttachProrationTypedDict": ".multiattachop", + "MultiAttachRedirectMode": ".multiattachop", + "MultiAttachRequiredAction": ".multiattachop", + "MultiAttachRequiredActionTypedDict": ".multiattachop", + "MultiAttachReset": ".multiattachop", + "MultiAttachResetInterval": ".multiattachop", + "MultiAttachResetTypedDict": ".multiattachop", + "MultiAttachResponse": ".multiattachop", + "MultiAttachResponseTypedDict": ".multiattachop", + "MultiAttachRollover": ".multiattachop", + "MultiAttachRolloverTypedDict": ".multiattachop", + "MultiAttachTier": ".multiattachop", + "MultiAttachTierBehavior": ".multiattachop", + "MultiAttachTierTypedDict": ".multiattachop", + "MultiAttachTo": ".multiattachop", + "MultiAttachToTypedDict": ".multiattachop", "OpenCustomerPortalGlobals": ".opencustomerportalop", "OpenCustomerPortalGlobalsTypedDict": ".opencustomerportalop", "OpenCustomerPortalParams": ".opencustomerportalop", "OpenCustomerPortalParamsTypedDict": ".opencustomerportalop", "OpenCustomerPortalResponse": ".opencustomerportalop", "OpenCustomerPortalResponseTypedDict": ".opencustomerportalop", + "CustomerEligibility": ".plan", + "CustomerEligibilityTypedDict": ".plan", "ExpiryDurationType": ".plan", "FreeTrial": ".plan", "FreeTrialTypedDict": ".plan", @@ -2098,11 +2502,13 @@ _dynamic_imports: dict[str, str] = { "PlanRollover": ".plan", "PlanRolloverTypedDict": ".plan", "PlanTier": ".plan", + "PlanTierBehavior": ".plan", "PlanTierTypedDict": ".plan", "PlanTo": ".plan", "PlanToTypedDict": ".plan", "PlanType": ".plan", "PlanTypedDict": ".plan", + "Scenario": ".plan", "PreviewAttachAttachDiscount": ".previewattachop", "PreviewAttachAttachDiscountTypedDict": ".previewattachop", "PreviewAttachBasePrice": ".previewattachop", @@ -2148,9 +2554,62 @@ _dynamic_imports: dict[str, str] = { "PreviewAttachRollover": ".previewattachop", "PreviewAttachRolloverTypedDict": ".previewattachop", "PreviewAttachTier": ".previewattachop", + "PreviewAttachTierBehavior": ".previewattachop", "PreviewAttachTierTypedDict": ".previewattachop", "PreviewAttachTo": ".previewattachop", "PreviewAttachToTypedDict": ".previewattachop", + "PreviewMultiAttachAttachDiscount": ".previewmultiattachop", + "PreviewMultiAttachAttachDiscountTypedDict": ".previewmultiattachop", + "PreviewMultiAttachBasePrice": ".previewmultiattachop", + "PreviewMultiAttachBasePriceTypedDict": ".previewmultiattachop", + "PreviewMultiAttachBillingMethod": ".previewmultiattachop", + "PreviewMultiAttachCustomize": ".previewmultiattachop", + "PreviewMultiAttachCustomizeTypedDict": ".previewmultiattachop", + "PreviewMultiAttachDiscount": ".previewmultiattachop", + "PreviewMultiAttachDiscountTypedDict": ".previewmultiattachop", + "PreviewMultiAttachDurationType": ".previewmultiattachop", + "PreviewMultiAttachEntityData": ".previewmultiattachop", + "PreviewMultiAttachEntityDataTypedDict": ".previewmultiattachop", + "PreviewMultiAttachExpiryDurationType": ".previewmultiattachop", + "PreviewMultiAttachFeatureQuantity": ".previewmultiattachop", + "PreviewMultiAttachFeatureQuantityTypedDict": ".previewmultiattachop", + "PreviewMultiAttachFreeTrialParams": ".previewmultiattachop", + "PreviewMultiAttachFreeTrialParamsTypedDict": ".previewmultiattachop", + "PreviewMultiAttachGlobals": ".previewmultiattachop", + "PreviewMultiAttachGlobalsTypedDict": ".previewmultiattachop", + "PreviewMultiAttachInvoiceMode": ".previewmultiattachop", + "PreviewMultiAttachInvoiceModeTypedDict": ".previewmultiattachop", + "PreviewMultiAttachItemPriceInterval": ".previewmultiattachop", + "PreviewMultiAttachLineItem": ".previewmultiattachop", + "PreviewMultiAttachLineItemTypedDict": ".previewmultiattachop", + "PreviewMultiAttachNextCycle": ".previewmultiattachop", + "PreviewMultiAttachNextCycleTypedDict": ".previewmultiattachop", + "PreviewMultiAttachOnDecrease": ".previewmultiattachop", + "PreviewMultiAttachOnIncrease": ".previewmultiattachop", + "PreviewMultiAttachParams": ".previewmultiattachop", + "PreviewMultiAttachParamsTypedDict": ".previewmultiattachop", + "PreviewMultiAttachPlan": ".previewmultiattachop", + "PreviewMultiAttachPlanItem": ".previewmultiattachop", + "PreviewMultiAttachPlanItemTypedDict": ".previewmultiattachop", + "PreviewMultiAttachPlanTypedDict": ".previewmultiattachop", + "PreviewMultiAttachPrice": ".previewmultiattachop", + "PreviewMultiAttachPriceInterval": ".previewmultiattachop", + "PreviewMultiAttachPriceTypedDict": ".previewmultiattachop", + "PreviewMultiAttachProration": ".previewmultiattachop", + "PreviewMultiAttachProrationTypedDict": ".previewmultiattachop", + "PreviewMultiAttachRedirectMode": ".previewmultiattachop", + "PreviewMultiAttachReset": ".previewmultiattachop", + "PreviewMultiAttachResetInterval": ".previewmultiattachop", + "PreviewMultiAttachResetTypedDict": ".previewmultiattachop", + "PreviewMultiAttachResponse": ".previewmultiattachop", + "PreviewMultiAttachResponseTypedDict": ".previewmultiattachop", + "PreviewMultiAttachRollover": ".previewmultiattachop", + "PreviewMultiAttachRolloverTypedDict": ".previewmultiattachop", + "PreviewMultiAttachTier": ".previewmultiattachop", + "PreviewMultiAttachTierBehavior": ".previewmultiattachop", + "PreviewMultiAttachTierTypedDict": ".previewmultiattachop", + "PreviewMultiAttachTo": ".previewmultiattachop", + "PreviewMultiAttachToTypedDict": ".previewmultiattachop", "PreviewUpdateBasePrice": ".previewupdateop", "PreviewUpdateBasePriceTypedDict": ".previewupdateop", "PreviewUpdateBillingMethod": ".previewupdateop", @@ -2194,6 +2653,7 @@ _dynamic_imports: dict[str, str] = { "PreviewUpdateRollover": ".previewupdateop", "PreviewUpdateRolloverTypedDict": ".previewupdateop", "PreviewUpdateTier": ".previewupdateop", + "PreviewUpdateTierBehavior": ".previewupdateop", "PreviewUpdateTierTypedDict": ".previewupdateop", "PreviewUpdateTo": ".previewupdateop", "PreviewUpdateToTypedDict": ".previewupdateop", @@ -2205,12 +2665,46 @@ _dynamic_imports: dict[str, str] = { "RedeemReferralCodeResponseTypedDict": ".redeemreferralcodeop", "Security": ".security", "SecurityTypedDict": ".security", + "SetupPaymentAttachDiscount": ".setuppaymentop", + "SetupPaymentAttachDiscountTypedDict": ".setuppaymentop", + "SetupPaymentBasePrice": ".setuppaymentop", + "SetupPaymentBasePriceTypedDict": ".setuppaymentop", + "SetupPaymentBillingMethod": ".setuppaymentop", + "SetupPaymentCustomize": ".setuppaymentop", + "SetupPaymentCustomizeTypedDict": ".setuppaymentop", + "SetupPaymentDurationType": ".setuppaymentop", + "SetupPaymentExpiryDurationType": ".setuppaymentop", + "SetupPaymentFeatureQuantity": ".setuppaymentop", + "SetupPaymentFeatureQuantityTypedDict": ".setuppaymentop", + "SetupPaymentFreeTrialParams": ".setuppaymentop", + "SetupPaymentFreeTrialParamsTypedDict": ".setuppaymentop", "SetupPaymentGlobals": ".setuppaymentop", "SetupPaymentGlobalsTypedDict": ".setuppaymentop", + "SetupPaymentItemPriceInterval": ".setuppaymentop", + "SetupPaymentOnDecrease": ".setuppaymentop", + "SetupPaymentOnIncrease": ".setuppaymentop", "SetupPaymentParams": ".setuppaymentop", "SetupPaymentParamsTypedDict": ".setuppaymentop", + "SetupPaymentPlanItem": ".setuppaymentop", + "SetupPaymentPlanItemTypedDict": ".setuppaymentop", + "SetupPaymentPrice": ".setuppaymentop", + "SetupPaymentPriceInterval": ".setuppaymentop", + "SetupPaymentPriceTypedDict": ".setuppaymentop", + "SetupPaymentProration": ".setuppaymentop", + "SetupPaymentProrationBehavior": ".setuppaymentop", + "SetupPaymentProrationTypedDict": ".setuppaymentop", + "SetupPaymentReset": ".setuppaymentop", + "SetupPaymentResetInterval": ".setuppaymentop", + "SetupPaymentResetTypedDict": ".setuppaymentop", "SetupPaymentResponse": ".setuppaymentop", "SetupPaymentResponseTypedDict": ".setuppaymentop", + "SetupPaymentRollover": ".setuppaymentop", + "SetupPaymentRolloverTypedDict": ".setuppaymentop", + "SetupPaymentTier": ".setuppaymentop", + "SetupPaymentTierBehavior": ".setuppaymentop", + "SetupPaymentTierTypedDict": ".setuppaymentop", + "SetupPaymentTo": ".setuppaymentop", + "SetupPaymentToTypedDict": ".setuppaymentop", "TrackGlobals": ".trackop", "TrackGlobalsTypedDict": ".trackop", "TrackParams": ".trackop", @@ -2258,6 +2752,8 @@ _dynamic_imports: dict[str, str] = { "UpdatePlanBillingMethodResponse": ".updateplanop", "UpdatePlanCreditSchema": ".updateplanop", "UpdatePlanCreditSchemaTypedDict": ".updateplanop", + "UpdatePlanCustomerEligibility": ".updateplanop", + "UpdatePlanCustomerEligibilityTypedDict": ".updateplanop", "UpdatePlanDurationTypeRequest": ".updateplanop", "UpdatePlanDurationTypeResponse": ".updateplanop", "UpdatePlanEnv": ".updateplanop", @@ -2309,6 +2805,9 @@ _dynamic_imports: dict[str, str] = { "UpdatePlanRolloverRequestTypedDict": ".updateplanop", "UpdatePlanRolloverResponse": ".updateplanop", "UpdatePlanRolloverResponseTypedDict": ".updateplanop", + "UpdatePlanScenario": ".updateplanop", + "UpdatePlanTierBehaviorRequest": ".updateplanop", + "UpdatePlanTierBehaviorResponse": ".updateplanop", "UpdatePlanTierRequest": ".updateplanop", "UpdatePlanTierRequestTypedDict": ".updateplanop", "UpdatePlanTierResponse": ".updateplanop", diff --git a/others/python-sdk/src/autumn_sdk/models/billingattachop.py b/others/python-sdk/src/autumn_sdk/models/attachop.py similarity index 80% rename from others/python-sdk/src/autumn_sdk/models/billingattachop.py rename to others/python-sdk/src/autumn_sdk/models/attachop.py index d16b8c47d..d6eeb9edf 100644 --- a/others/python-sdk/src/autumn_sdk/models/billingattachop.py +++ b/others/python-sdk/src/autumn_sdk/models/attachop.py @@ -12,15 +12,15 @@ from autumn_sdk.types import ( from autumn_sdk.utils import FieldMetadata, HeaderMetadata import pydantic from pydantic import model_serializer -from typing import List, Literal, Optional, Union +from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -class BillingAttachGlobalsTypedDict(TypedDict): +class AttachGlobalsTypedDict(TypedDict): x_api_version: NotRequired[str] -class BillingAttachGlobals(BaseModel): +class AttachGlobals(BaseModel): x_api_version: Annotated[ Optional[str], pydantic.Field(alias="x-api-version"), @@ -44,7 +44,7 @@ class BillingAttachGlobals(BaseModel): return m -class BillingAttachFeatureQuantityTypedDict(TypedDict): +class AttachFeatureQuantityTypedDict(TypedDict): r"""Quantity configuration for a prepaid feature.""" feature_id: str @@ -55,7 +55,7 @@ class BillingAttachFeatureQuantityTypedDict(TypedDict): r"""Whether the customer can adjust the quantity.""" -class BillingAttachFeatureQuantity(BaseModel): +class AttachFeatureQuantity(BaseModel): r"""Quantity configuration for a prepaid feature.""" feature_id: str @@ -84,7 +84,7 @@ class BillingAttachFeatureQuantity(BaseModel): return m -BillingAttachPriceInterval = Literal[ +AttachPriceInterval = Literal[ "one_off", "week", "month", @@ -95,24 +95,24 @@ BillingAttachPriceInterval = Literal[ r"""Billing interval (e.g. 'month', 'year').""" -class BillingAttachBasePriceTypedDict(TypedDict): +class AttachBasePriceTypedDict(TypedDict): r"""Base price configuration for a plan.""" amount: float r"""Base price amount for the plan.""" - interval: BillingAttachPriceInterval + interval: AttachPriceInterval r"""Billing interval (e.g. 'month', 'year').""" interval_count: NotRequired[float] r"""Number of intervals per billing cycle. Defaults to 1.""" -class BillingAttachBasePrice(BaseModel): +class AttachBasePrice(BaseModel): r"""Base price configuration for a plan.""" amount: float r"""Base price amount for the plan.""" - interval: BillingAttachPriceInterval + interval: AttachPriceInterval r"""Billing interval (e.g. 'month', 'year').""" interval_count: Optional[float] = None @@ -135,7 +135,7 @@ class BillingAttachBasePrice(BaseModel): return m -BillingAttachResetInterval = Literal[ +AttachResetInterval = Literal[ "one_off", "minute", "hour", @@ -149,19 +149,19 @@ BillingAttachResetInterval = Literal[ r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" -class BillingAttachResetTypedDict(TypedDict): +class AttachResetTypedDict(TypedDict): r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" - interval: BillingAttachResetInterval + interval: AttachResetInterval 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): +class AttachReset(BaseModel): r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" - interval: BillingAttachResetInterval + interval: AttachResetInterval r"""Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.""" interval_count: Optional[float] = None @@ -184,24 +184,58 @@ class BillingAttachReset(BaseModel): return m -BillingAttachToTypedDict = TypeAliasType("BillingAttachToTypedDict", Union[float, str]) +AttachToTypedDict = TypeAliasType("AttachToTypedDict", Union[float, str]) -BillingAttachTo = TypeAliasType("BillingAttachTo", Union[float, str]) +AttachTo = TypeAliasType("AttachTo", Union[float, str]) -class BillingAttachTierTypedDict(TypedDict): - to: BillingAttachToTypedDict +class AttachTierTypedDict(TypedDict): + to: AttachToTypedDict amount: float + flat_amount: NotRequired[Nullable[float]] -class BillingAttachTier(BaseModel): - to: BillingAttachTo +class AttachTier(BaseModel): + to: AttachTo amount: float + flat_amount: OptionalNullable[float] = UNSET -BillingAttachItemPriceInterval = Literal[ + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +AttachTierBehavior = Literal[ + "graduated", + "volume", +] + + +AttachItemPriceInterval = Literal[ "one_off", "week", "month", @@ -212,24 +246,25 @@ BillingAttachItemPriceInterval = Literal[ r"""Billing interval. For consumable features, should match reset.interval.""" -BillingAttachBillingMethod = Literal[ +AttachBillingMethod = Literal[ "prepaid", "usage_based", ] r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" -class BillingAttachPriceTypedDict(TypedDict): +class AttachPriceTypedDict(TypedDict): r"""Pricing for usage beyond included units. Omit for free features.""" - interval: BillingAttachItemPriceInterval + interval: AttachItemPriceInterval r"""Billing interval. For consumable features, should match reset.interval.""" - billing_method: BillingAttachBillingMethod + billing_method: AttachBillingMethod 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.""" + tiers: NotRequired[List[AttachTierTypedDict]] + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + tier_behavior: NotRequired[AttachTierBehavior] interval_count: NotRequired[float] r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: NotRequired[float] @@ -238,20 +273,22 @@ class BillingAttachPriceTypedDict(TypedDict): r"""Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total.""" -class BillingAttachPrice(BaseModel): +class AttachPrice(BaseModel): r"""Pricing for usage beyond included units. Omit for free features.""" - interval: BillingAttachItemPriceInterval + interval: AttachItemPriceInterval r"""Billing interval. For consumable features, should match reset.interval.""" - billing_method: BillingAttachBillingMethod + billing_method: AttachBillingMethod 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.""" + tiers: Optional[List[AttachTier]] = None + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + + tier_behavior: Optional[AttachTierBehavior] = None interval_count: Optional[float] = 1 r"""Number of intervals per billing cycle. Defaults to 1.""" @@ -265,7 +302,14 @@ class BillingAttachPrice(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["amount", "tiers", "interval_count", "billing_units", "max_purchase"] + [ + "amount", + "tiers", + "tier_behavior", + "interval_count", + "billing_units", + "max_purchase", + ] ) serialized = handler(self) m = {} @@ -281,7 +325,7 @@ class BillingAttachPrice(BaseModel): return m -BillingAttachOnIncrease = Literal[ +AttachOnIncrease = Literal[ "bill_immediately", "prorate_immediately", "prorate_next_cycle", @@ -290,7 +334,7 @@ BillingAttachOnIncrease = Literal[ r"""Billing behavior when quantity increases mid-cycle.""" -BillingAttachOnDecrease = Literal[ +AttachOnDecrease = Literal[ "prorate", "prorate_immediately", "prorate_next_cycle", @@ -300,36 +344,36 @@ BillingAttachOnDecrease = Literal[ r"""Credit behavior when quantity decreases mid-cycle.""" -class BillingAttachProrationTypedDict(TypedDict): +class AttachProrationTypedDict(TypedDict): r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" - on_increase: BillingAttachOnIncrease + on_increase: AttachOnIncrease r"""Billing behavior when quantity increases mid-cycle.""" - on_decrease: BillingAttachOnDecrease + on_decrease: AttachOnDecrease r"""Credit behavior when quantity decreases mid-cycle.""" -class BillingAttachProration(BaseModel): +class AttachProration(BaseModel): r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" - on_increase: BillingAttachOnIncrease + on_increase: AttachOnIncrease r"""Billing behavior when quantity increases mid-cycle.""" - on_decrease: BillingAttachOnDecrease + on_decrease: AttachOnDecrease r"""Credit behavior when quantity decreases mid-cycle.""" -BillingAttachExpiryDurationType = Literal[ +AttachExpiryDurationType = Literal[ "month", "forever", ] r"""When rolled over units expire.""" -class BillingAttachRolloverTypedDict(TypedDict): +class AttachRolloverTypedDict(TypedDict): r"""Rollover config for unused units. If set, unused included units carry over.""" - expiry_duration_type: BillingAttachExpiryDurationType + expiry_duration_type: AttachExpiryDurationType r"""When rolled over units expire.""" max: NotRequired[float] r"""Max rollover units. Omit for unlimited rollover.""" @@ -337,10 +381,10 @@ class BillingAttachRolloverTypedDict(TypedDict): r"""Number of periods before expiry.""" -class BillingAttachRollover(BaseModel): +class AttachRollover(BaseModel): r"""Rollover config for unused units. If set, unused included units carry over.""" - expiry_duration_type: BillingAttachExpiryDurationType + expiry_duration_type: AttachExpiryDurationType r"""When rolled over units expire.""" max: Optional[float] = None @@ -366,7 +410,7 @@ class BillingAttachRollover(BaseModel): return m -class BillingAttachPlanItemTypedDict(TypedDict): +class AttachPlanItemTypedDict(TypedDict): r"""Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings.""" feature_id: str @@ -375,17 +419,17 @@ class BillingAttachPlanItemTypedDict(TypedDict): 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] + reset: NotRequired[AttachResetTypedDict] r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" - price: NotRequired[BillingAttachPriceTypedDict] + price: NotRequired[AttachPriceTypedDict] r"""Pricing for usage beyond included units. Omit for free features.""" - proration: NotRequired[BillingAttachProrationTypedDict] + proration: NotRequired[AttachProrationTypedDict] r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" - rollover: NotRequired[BillingAttachRolloverTypedDict] + rollover: NotRequired[AttachRolloverTypedDict] r"""Rollover config for unused units. If set, unused included units carry over.""" -class BillingAttachPlanItem(BaseModel): +class AttachPlanItem(BaseModel): r"""Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings.""" feature_id: str @@ -397,16 +441,16 @@ class BillingAttachPlanItem(BaseModel): unlimited: Optional[bool] = None r"""If true, customer has unlimited access to this feature.""" - reset: Optional[BillingAttachReset] = None + reset: Optional[AttachReset] = None r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" - price: Optional[BillingAttachPrice] = None + price: Optional[AttachPrice] = None r"""Pricing for usage beyond included units. Omit for free features.""" - proration: Optional[BillingAttachProration] = None + proration: Optional[AttachProration] = None r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" - rollover: Optional[BillingAttachRollover] = None + rollover: Optional[AttachRollover] = None r"""Rollover config for unused units. If set, unused included units carry over.""" @model_serializer(mode="wrap") @@ -428,7 +472,7 @@ class BillingAttachPlanItem(BaseModel): return m -BillingAttachDurationType = Literal[ +AttachDurationType = Literal[ "day", "month", "year", @@ -436,24 +480,24 @@ BillingAttachDurationType = Literal[ r"""Unit of time for the trial ('day', 'month', 'year').""" -class BillingAttachFreeTrialParamsTypedDict(TypedDict): +class AttachFreeTrialParamsTypedDict(TypedDict): r"""Free trial configuration for a plan.""" duration_length: float r"""Number of duration_type periods the trial lasts.""" - duration_type: NotRequired[BillingAttachDurationType] + duration_type: NotRequired[AttachDurationType] 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 BillingAttachFreeTrialParams(BaseModel): +class AttachFreeTrialParams(BaseModel): r"""Free trial configuration for a plan.""" duration_length: float r"""Number of duration_type periods the trial lasts.""" - duration_type: Optional[BillingAttachDurationType] = "month" + duration_type: Optional[AttachDurationType] = "month" r"""Unit of time for the trial ('day', 'month', 'year').""" card_required: Optional[bool] = True @@ -476,27 +520,27 @@ class BillingAttachFreeTrialParams(BaseModel): return m -class BillingAttachCustomizeTypedDict(TypedDict): +class AttachCustomizeTypedDict(TypedDict): r"""Customize the plan to attach. Can override the price, items, free trial, or a combination.""" - price: NotRequired[Nullable[BillingAttachBasePriceTypedDict]] + price: NotRequired[Nullable[AttachBasePriceTypedDict]] r"""Override the base price of the plan. Pass null to remove the base price.""" - items: NotRequired[List[BillingAttachPlanItemTypedDict]] + items: NotRequired[List[AttachPlanItemTypedDict]] r"""Override the items in the plan.""" - free_trial: NotRequired[Nullable[BillingAttachFreeTrialParamsTypedDict]] + free_trial: NotRequired[Nullable[AttachFreeTrialParamsTypedDict]] r"""Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.""" -class BillingAttachCustomize(BaseModel): +class AttachCustomize(BaseModel): r"""Customize the plan to attach. Can override the price, items, free trial, or a combination.""" - price: OptionalNullable[BillingAttachBasePrice] = UNSET + price: OptionalNullable[AttachBasePrice] = UNSET r"""Override the base price of the plan. Pass null to remove the base price.""" - items: Optional[List[BillingAttachPlanItem]] = None + items: Optional[List[AttachPlanItem]] = None r"""Override the items in the plan.""" - free_trial: OptionalNullable[BillingAttachFreeTrialParams] = UNSET + free_trial: OptionalNullable[AttachFreeTrialParams] = UNSET r"""Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.""" @model_serializer(mode="wrap") @@ -525,7 +569,7 @@ class BillingAttachCustomize(BaseModel): return m -class BillingAttachInvoiceModeTypedDict(TypedDict): +class AttachInvoiceModeTypedDict(TypedDict): r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" enabled: bool @@ -536,7 +580,7 @@ class BillingAttachInvoiceModeTypedDict(TypedDict): r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.""" -class BillingAttachInvoiceMode(BaseModel): +class AttachInvoiceMode(BaseModel): r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" enabled: bool @@ -565,14 +609,14 @@ class BillingAttachInvoiceMode(BaseModel): return m -BillingAttachProrationBehavior = Literal[ +AttachProrationBehavior = Literal[ "prorate_immediately", "none", ] r"""How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges.""" -class BillingAttachAttachDiscountTypedDict(TypedDict): +class AttachAttachDiscountTypedDict(TypedDict): r"""A discount to apply. Can be either a reward ID or a promotion code.""" reward_id: NotRequired[str] @@ -581,7 +625,7 @@ class BillingAttachAttachDiscountTypedDict(TypedDict): r"""The promotion code to apply as a discount.""" -class BillingAttachAttachDiscount(BaseModel): +class AttachAttachDiscount(BaseModel): r"""A discount to apply. Can be either a reward ID or a promotion code.""" reward_id: Optional[str] = None @@ -607,7 +651,7 @@ class BillingAttachAttachDiscount(BaseModel): return m -BillingAttachPlanSchedule = Literal[ +AttachPlanSchedule = Literal[ "immediate", "end_of_cycle", ] @@ -621,24 +665,26 @@ class AttachParamsTypedDict(TypedDict): r"""The ID of the plan.""" entity_id: NotRequired[str] r"""The ID of the entity to attach the plan to.""" - feature_quantities: NotRequired[List[BillingAttachFeatureQuantityTypedDict]] + feature_quantities: NotRequired[List[AttachFeatureQuantityTypedDict]] r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" version: NotRequired[float] r"""The version of the plan to attach.""" - customize: NotRequired[BillingAttachCustomizeTypedDict] + customize: NotRequired[AttachCustomizeTypedDict] r"""Customize the plan to attach. Can override the price, items, free trial, or a combination.""" - invoice_mode: NotRequired[BillingAttachInvoiceModeTypedDict] + invoice_mode: NotRequired[AttachInvoiceModeTypedDict] r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" - proration_behavior: NotRequired[BillingAttachProrationBehavior] + proration_behavior: NotRequired[AttachProrationBehavior] r"""How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges.""" - discounts: NotRequired[List[BillingAttachAttachDiscountTypedDict]] + discounts: NotRequired[List[AttachAttachDiscountTypedDict]] r"""List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.""" success_url: NotRequired[str] r"""URL to redirect to after successful checkout.""" new_billing_subscription: NotRequired[bool] r"""Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.""" - plan_schedule: NotRequired[BillingAttachPlanSchedule] + plan_schedule: NotRequired[AttachPlanSchedule] r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.""" + checkout_session_params: NotRequired[Dict[str, Any]] + r"""Additional parameters to pass into the creation of the Stripe checkout session.""" class AttachParams(BaseModel): @@ -651,22 +697,22 @@ class AttachParams(BaseModel): entity_id: Optional[str] = None r"""The ID of the entity to attach the plan to.""" - feature_quantities: Optional[List[BillingAttachFeatureQuantity]] = None + feature_quantities: Optional[List[AttachFeatureQuantity]] = None r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" version: Optional[float] = None r"""The version of the plan to attach.""" - customize: Optional[BillingAttachCustomize] = None + customize: Optional[AttachCustomize] = None r"""Customize the plan to attach. Can override the price, items, free trial, or a combination.""" - invoice_mode: Optional[BillingAttachInvoiceMode] = None + invoice_mode: Optional[AttachInvoiceMode] = None r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" - proration_behavior: Optional[BillingAttachProrationBehavior] = None + proration_behavior: Optional[AttachProrationBehavior] = None r"""How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges.""" - discounts: Optional[List[BillingAttachAttachDiscount]] = None + discounts: Optional[List[AttachAttachDiscount]] = None r"""List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.""" success_url: Optional[str] = None @@ -675,9 +721,12 @@ class AttachParams(BaseModel): new_billing_subscription: Optional[bool] = None r"""Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.""" - plan_schedule: Optional[BillingAttachPlanSchedule] = None + plan_schedule: Optional[AttachPlanSchedule] = None r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.""" + checkout_session_params: Optional[Dict[str, Any]] = None + r"""Additional parameters to pass into the creation of the Stripe checkout session.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -692,6 +741,7 @@ class AttachParams(BaseModel): "success_url", "new_billing_subscription", "plan_schedule", + "checkout_session_params", ] ) serialized = handler(self) @@ -708,7 +758,7 @@ class AttachParams(BaseModel): return m -class BillingAttachInvoiceTypedDict(TypedDict): +class AttachInvoiceTypedDict(TypedDict): r"""Invoice details if an invoice was created. Only present when a charge was made.""" status: Nullable[str] @@ -723,7 +773,7 @@ class BillingAttachInvoiceTypedDict(TypedDict): r"""URL to the hosted invoice page where the customer can view and pay the invoice.""" -class BillingAttachInvoice(BaseModel): +class AttachInvoice(BaseModel): r"""Invoice details if an invoice was created. Only present when a charge was made.""" status: Nullable[str] @@ -756,7 +806,7 @@ class BillingAttachInvoice(BaseModel): return m -BillingAttachCode = Union[ +AttachCode = Union[ Literal[ "3ds_required", "payment_method_required", @@ -767,26 +817,26 @@ BillingAttachCode = Union[ r"""The type of action required to complete the payment.""" -class BillingAttachRequiredActionTypedDict(TypedDict): +class AttachRequiredActionTypedDict(TypedDict): r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" - code: BillingAttachCode + code: AttachCode r"""The type of action required to complete the payment.""" reason: str r"""A human-readable explanation of why this action is required.""" -class BillingAttachRequiredAction(BaseModel): +class AttachRequiredAction(BaseModel): r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" - code: BillingAttachCode + code: AttachCode r"""The type of action required to complete the payment.""" reason: str r"""A human-readable explanation of why this action is required.""" -class BillingAttachResponseTypedDict(TypedDict): +class AttachResponseTypedDict(TypedDict): r"""OK""" customer_id: str @@ -795,13 +845,13 @@ class BillingAttachResponseTypedDict(TypedDict): r"""URL to redirect the customer to complete payment. Null if no payment action is required.""" entity_id: NotRequired[str] r"""The ID of the entity, if the plan was attached to an entity.""" - invoice: NotRequired[BillingAttachInvoiceTypedDict] + invoice: NotRequired[AttachInvoiceTypedDict] r"""Invoice details if an invoice was created. Only present when a charge was made.""" - required_action: NotRequired[BillingAttachRequiredActionTypedDict] + required_action: NotRequired[AttachRequiredActionTypedDict] r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" -class BillingAttachResponse(BaseModel): +class AttachResponse(BaseModel): r"""OK""" customer_id: str @@ -813,10 +863,10 @@ class BillingAttachResponse(BaseModel): entity_id: Optional[str] = None r"""The ID of the entity, if the plan was attached to an entity.""" - invoice: Optional[BillingAttachInvoice] = None + invoice: Optional[AttachInvoice] = None r"""Invoice details if an invoice was created. Only present when a charge was made.""" - required_action: Optional[BillingAttachRequiredAction] = None + required_action: Optional[AttachRequiredAction] = None r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" @model_serializer(mode="wrap") diff --git a/others/python-sdk/src/autumn_sdk/models/balance.py b/others/python-sdk/src/autumn_sdk/models/balance.py index 30665ef90..32a43911c 100644 --- a/others/python-sdk/src/autumn_sdk/models/balance.py +++ b/others/python-sdk/src/autumn_sdk/models/balance.py @@ -227,6 +227,7 @@ BalanceTo = TypeAliasType("BalanceTo", Union[float, str]) class BalanceTierTypedDict(TypedDict): to: BalanceToTypedDict amount: float + flat_amount: NotRequired[Nullable[float]] class BalanceTier(BaseModel): @@ -234,6 +235,43 @@ class BalanceTier(BaseModel): amount: float + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +BalanceTierBehavior = Union[ + Literal[ + "graduated", + "volume", + ], + UnrecognizedStr, +] +r"""How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier).""" + BalanceBillingMethod = Union[ Literal[ @@ -256,6 +294,8 @@ class BalancePriceTypedDict(TypedDict): r"""The per-unit price amount.""" tiers: NotRequired[List[BalanceTierTypedDict]] r"""Tiered pricing configuration if applicable.""" + tier_behavior: NotRequired[BalanceTierBehavior] + r"""How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier).""" class BalancePrice(BaseModel): @@ -274,9 +314,12 @@ class BalancePrice(BaseModel): tiers: Optional[List[BalanceTier]] = None r"""Tiered pricing configuration if applicable.""" + tier_behavior: Optional[BalanceTierBehavior] = None + r"""How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier).""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["amount", "tiers"]) + optional_fields = set(["amount", "tiers", "tier_behavior"]) nullable_fields = set(["max_purchase"]) serialized = handler(self) m = {} diff --git a/others/python-sdk/src/autumn_sdk/models/billingupdateop.py b/others/python-sdk/src/autumn_sdk/models/billingupdateop.py index bbb2d7a24..956603163 100644 --- a/others/python-sdk/src/autumn_sdk/models/billingupdateop.py +++ b/others/python-sdk/src/autumn_sdk/models/billingupdateop.py @@ -193,6 +193,7 @@ BillingUpdateTo = TypeAliasType("BillingUpdateTo", Union[float, str]) class BillingUpdateTierTypedDict(TypedDict): to: BillingUpdateToTypedDict amount: float + flat_amount: NotRequired[Nullable[float]] class BillingUpdateTier(BaseModel): @@ -200,6 +201,39 @@ class BillingUpdateTier(BaseModel): amount: float + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +BillingUpdateTierBehavior = Literal[ + "graduated", + "volume", +] + BillingUpdateItemPriceInterval = Literal[ "one_off", @@ -229,7 +263,8 @@ class BillingUpdatePriceTypedDict(TypedDict): 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.""" + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + tier_behavior: NotRequired[BillingUpdateTierBehavior] interval_count: NotRequired[float] r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: NotRequired[float] @@ -251,7 +286,9 @@ class BillingUpdatePrice(BaseModel): 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.""" + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + + tier_behavior: Optional[BillingUpdateTierBehavior] = None interval_count: Optional[float] = 1 r"""Number of intervals per billing cycle. Defaults to 1.""" @@ -265,7 +302,14 @@ class BillingUpdatePrice(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["amount", "tiers", "interval_count", "billing_units", "max_purchase"] + [ + "amount", + "tiers", + "tier_behavior", + "interval_count", + "billing_units", + "max_purchase", + ] ) serialized = handler(self) m = {} diff --git a/others/python-sdk/src/autumn_sdk/models/checkop.py b/others/python-sdk/src/autumn_sdk/models/checkop.py index 21a4f89c0..935fa6bdf 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 -Scenario = Union[ +CheckScenario = Union[ Literal[ "usage_limit", "feature_flag", @@ -184,6 +184,8 @@ class TiersTypedDict(TypedDict): r"""The maximum amount of usage for this tier.""" amount: float r"""The price of the product item for this tier.""" + flat_amount: NotRequired[Nullable[float]] + r"""A flat fee charged for this tier, in addition to the per-unit amount.""" class Tiers(BaseModel): @@ -193,6 +195,43 @@ class Tiers(BaseModel): amount: float r"""The price of the product item for this tier.""" + flat_amount: OptionalNullable[float] = UNSET + r"""A flat fee charged for this tier, in addition to the per-unit amount.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +CheckTierBehavior = Union[ + Literal[ + "graduated", + "volume", + ], + UnrecognizedStr, +] + UsageModel = Union[ Literal[ @@ -368,6 +407,8 @@ class CheckItemTypedDict(TypedDict): r"""The price of the product item. Should be `null` if tiered pricing is set.""" tiers: NotRequired[Nullable[List[TiersTypedDict]]] r"""Tiered pricing for the product item. Not applicable for fixed price items.""" + tier_behavior: NotRequired[Nullable[CheckTierBehavior]] + r"""How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). Defaults to graduated.""" usage_model: NotRequired[Nullable[UsageModel]] r"""Whether the feature should be prepaid upfront or billed for how much they use end of billing period.""" billing_units: NotRequired[Nullable[float]] @@ -413,6 +454,9 @@ class CheckItem(BaseModel): tiers: OptionalNullable[List[Tiers]] = UNSET r"""Tiered pricing for the product item. Not applicable for fixed price items.""" + tier_behavior: OptionalNullable[CheckTierBehavior] = UNSET + r"""How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). Defaults to graduated.""" + usage_model: OptionalNullable[UsageModel] = UNSET r"""Whether the feature should be prepaid upfront or billed for how much they use end of billing period.""" @@ -449,6 +493,7 @@ class CheckItem(BaseModel): "interval_count", "price", "tiers", + "tier_behavior", "usage_model", "billing_units", "reset_usage_when_enabled", @@ -469,6 +514,7 @@ class CheckItem(BaseModel): "interval_count", "price", "tiers", + "tier_behavior", "usage_model", "billing_units", "reset_usage_when_enabled", @@ -740,7 +786,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: Scenario + scenario: CheckScenario 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 +803,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: Scenario + scenario: CheckScenario 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 index 1acc2509e..458dd0beb 100644 --- a/others/python-sdk/src/autumn_sdk/models/createplanop.py +++ b/others/python-sdk/src/autumn_sdk/models/createplanop.py @@ -155,6 +155,7 @@ CreatePlanToRequest = TypeAliasType("CreatePlanToRequest", Union[float, str]) class CreatePlanTierRequestTypedDict(TypedDict): to: CreatePlanToRequestTypedDict amount: float + flat_amount: NotRequired[Nullable[float]] class CreatePlanTierRequest(BaseModel): @@ -162,6 +163,39 @@ class CreatePlanTierRequest(BaseModel): amount: float + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +CreatePlanTierBehaviorRequest = Literal[ + "graduated", + "volume", +] + CreatePlanItemPriceIntervalRequest = Literal[ "one_off", @@ -191,7 +225,8 @@ class CreatePlanItemPriceRequestTypedDict(TypedDict): 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.""" + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + tier_behavior: NotRequired[CreatePlanTierBehaviorRequest] interval_count: NotRequired[float] r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: NotRequired[float] @@ -213,7 +248,9 @@ class CreatePlanItemPriceRequest(BaseModel): 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.""" + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + + tier_behavior: Optional[CreatePlanTierBehaviorRequest] = None interval_count: Optional[float] = 1 r"""Number of intervals per billing cycle. Defaults to 1.""" @@ -227,7 +264,14 @@ class CreatePlanItemPriceRequest(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["amount", "tiers", "interval_count", "billing_units", "max_purchase"] + [ + "amount", + "tiers", + "tier_behavior", + "interval_count", + "billing_units", + "max_purchase", + ] ) serialized = handler(self) m = {} @@ -779,6 +823,7 @@ CreatePlanToResponse = TypeAliasType("CreatePlanToResponse", Union[float, str]) class CreatePlanTierResponseTypedDict(TypedDict): to: CreatePlanToResponseTypedDict amount: float + flat_amount: NotRequired[Nullable[float]] class CreatePlanTierResponse(BaseModel): @@ -786,6 +831,42 @@ class CreatePlanTierResponse(BaseModel): amount: float + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +CreatePlanTierBehaviorResponse = Union[ + Literal[ + "graduated", + "volume", + ], + UnrecognizedStr, +] + CreatePlanPriceItemIntervalResponse = Union[ Literal[ @@ -823,7 +904,8 @@ class CreatePlanItemPriceResponseTypedDict(TypedDict): 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.""" + r"""Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.""" + tier_behavior: NotRequired[CreatePlanTierBehaviorResponse] interval_count: NotRequired[float] r"""Number of intervals per billing cycle. Defaults to 1.""" @@ -845,14 +927,16 @@ class CreatePlanItemPriceResponse(BaseModel): 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.""" + r"""Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.""" + + tier_behavior: Optional[CreatePlanTierBehaviorResponse] = None 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"]) + optional_fields = set(["amount", "tiers", "tier_behavior", "interval_count"]) nullable_fields = set(["max_purchase"]) serialized = handler(self) m = {} @@ -1085,6 +1169,54 @@ CreatePlanEnv = Union[ r"""Environment this plan belongs to ('sandbox' or 'live').""" +CreatePlanScenario = Union[ + Literal[ + "scheduled", + "active", + "new", + "renew", + "upgrade", + "downgrade", + "cancel", + "expired", + "past_due", + ], + UnrecognizedStr, +] +r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + + +class CreatePlanCustomerEligibilityTypedDict(TypedDict): + scenario: CreatePlanScenario + r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + trial_available: NotRequired[bool] + r"""Whether a free trial is available for this customer.""" + + +class CreatePlanCustomerEligibility(BaseModel): + scenario: CreatePlanScenario + r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + + trial_available: Optional[bool] = None + r"""Whether a free trial is available for this customer.""" + + @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 + + class CreatePlanResponseTypedDict(TypedDict): r"""A plan defines a set of features, pricing, and entitlements that can be attached to customers.""" @@ -1116,6 +1248,7 @@ class CreatePlanResponseTypedDict(TypedDict): 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.""" + customer_eligibility: NotRequired[CreatePlanCustomerEligibilityTypedDict] class CreatePlanResponse(BaseModel): @@ -1163,9 +1296,11 @@ class CreatePlanResponse(BaseModel): free_trial: Optional[CreatePlanFreeTrialResponse] = None r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + customer_eligibility: Optional[CreatePlanCustomerEligibility] = None + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["free_trial"]) + optional_fields = set(["free_trial", "customer_eligibility"]) nullable_fields = set(["description", "group", "price", "base_variant_id"]) serialized = handler(self) m = {} diff --git a/others/python-sdk/src/autumn_sdk/models/getplanop.py b/others/python-sdk/src/autumn_sdk/models/getplanop.py index 9f3389434..bdd87c24f 100644 --- a/others/python-sdk/src/autumn_sdk/models/getplanop.py +++ b/others/python-sdk/src/autumn_sdk/models/getplanop.py @@ -329,6 +329,7 @@ GetPlanTo = TypeAliasType("GetPlanTo", Union[float, str]) class GetPlanTierTypedDict(TypedDict): to: GetPlanToTypedDict amount: float + flat_amount: NotRequired[Nullable[float]] class GetPlanTier(BaseModel): @@ -336,6 +337,42 @@ class GetPlanTier(BaseModel): amount: float + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +GetPlanTierBehavior = Union[ + Literal[ + "graduated", + "volume", + ], + UnrecognizedStr, +] + GetPlanPriceItemInterval = Union[ Literal[ @@ -373,7 +410,8 @@ class GetPlanItemPriceTypedDict(TypedDict): 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.""" + r"""Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.""" + tier_behavior: NotRequired[GetPlanTierBehavior] interval_count: NotRequired[float] r"""Number of intervals per billing cycle. Defaults to 1.""" @@ -395,14 +433,16 @@ class GetPlanItemPrice(BaseModel): 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.""" + r"""Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.""" + + tier_behavior: Optional[GetPlanTierBehavior] = None 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"]) + optional_fields = set(["amount", "tiers", "tier_behavior", "interval_count"]) nullable_fields = set(["max_purchase"]) serialized = handler(self) m = {} @@ -635,6 +675,54 @@ GetPlanEnv = Union[ r"""Environment this plan belongs to ('sandbox' or 'live').""" +GetPlanScenario = Union[ + Literal[ + "scheduled", + "active", + "new", + "renew", + "upgrade", + "downgrade", + "cancel", + "expired", + "past_due", + ], + UnrecognizedStr, +] +r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + + +class GetPlanCustomerEligibilityTypedDict(TypedDict): + scenario: GetPlanScenario + r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + trial_available: NotRequired[bool] + r"""Whether a free trial is available for this customer.""" + + +class GetPlanCustomerEligibility(BaseModel): + scenario: GetPlanScenario + r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + + trial_available: Optional[bool] = None + r"""Whether a free trial is available for this customer.""" + + @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 + + class GetPlanResponseTypedDict(TypedDict): r"""A plan defines a set of features, pricing, and entitlements that can be attached to customers.""" @@ -666,6 +754,7 @@ class GetPlanResponseTypedDict(TypedDict): 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.""" + customer_eligibility: NotRequired[GetPlanCustomerEligibilityTypedDict] class GetPlanResponse(BaseModel): @@ -713,9 +802,11 @@ class GetPlanResponse(BaseModel): free_trial: Optional[GetPlanFreeTrial] = None r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + customer_eligibility: Optional[GetPlanCustomerEligibility] = None + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["free_trial"]) + optional_fields = set(["free_trial", "customer_eligibility"]) nullable_fields = set(["description", "group", "price", "base_variant_id"]) serialized = handler(self) m = {} diff --git a/others/python-sdk/src/autumn_sdk/models/listplansop.py b/others/python-sdk/src/autumn_sdk/models/listplansop.py index 43c39a4af..a42050e77 100644 --- a/others/python-sdk/src/autumn_sdk/models/listplansop.py +++ b/others/python-sdk/src/autumn_sdk/models/listplansop.py @@ -334,6 +334,7 @@ ListPlansTo = TypeAliasType("ListPlansTo", Union[float, str]) class ListPlansTierTypedDict(TypedDict): to: ListPlansToTypedDict amount: float + flat_amount: NotRequired[Nullable[float]] class ListPlansTier(BaseModel): @@ -341,6 +342,42 @@ class ListPlansTier(BaseModel): amount: float + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +ListPlansTierBehavior = Union[ + Literal[ + "graduated", + "volume", + ], + UnrecognizedStr, +] + ListPlansPriceItemInterval = Union[ Literal[ @@ -378,7 +415,8 @@ class ListPlansItemPriceTypedDict(TypedDict): 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.""" + r"""Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.""" + tier_behavior: NotRequired[ListPlansTierBehavior] interval_count: NotRequired[float] r"""Number of intervals per billing cycle. Defaults to 1.""" @@ -400,14 +438,16 @@ class ListPlansItemPrice(BaseModel): 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.""" + r"""Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.""" + + tier_behavior: Optional[ListPlansTierBehavior] = None 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"]) + optional_fields = set(["amount", "tiers", "tier_behavior", "interval_count"]) nullable_fields = set(["max_purchase"]) serialized = handler(self) m = {} @@ -640,6 +680,54 @@ ListPlansEnv = Union[ r"""Environment this plan belongs to ('sandbox' or 'live').""" +ListPlansScenario = Union[ + Literal[ + "scheduled", + "active", + "new", + "renew", + "upgrade", + "downgrade", + "cancel", + "expired", + "past_due", + ], + UnrecognizedStr, +] +r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + + +class ListPlansCustomerEligibilityTypedDict(TypedDict): + scenario: ListPlansScenario + r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + trial_available: NotRequired[bool] + r"""Whether a free trial is available for this customer.""" + + +class ListPlansCustomerEligibility(BaseModel): + scenario: ListPlansScenario + r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + + trial_available: Optional[bool] = None + r"""Whether a free trial is available for this customer.""" + + @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 + + class ListPlansListTypedDict(TypedDict): r"""A plan defines a set of features, pricing, and entitlements that can be attached to customers.""" @@ -671,6 +759,7 @@ class ListPlansListTypedDict(TypedDict): 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.""" + customer_eligibility: NotRequired[ListPlansCustomerEligibilityTypedDict] class ListPlansList(BaseModel): @@ -718,9 +807,11 @@ class ListPlansList(BaseModel): free_trial: Optional[ListPlansFreeTrial] = None r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + customer_eligibility: Optional[ListPlansCustomerEligibility] = None + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["free_trial"]) + optional_fields = set(["free_trial", "customer_eligibility"]) nullable_fields = set(["description", "group", "price", "base_variant_id"]) serialized = handler(self) m = {} diff --git a/others/python-sdk/src/autumn_sdk/models/multiattachop.py b/others/python-sdk/src/autumn_sdk/models/multiattachop.py new file mode 100644 index 000000000..822fc2326 --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/multiattachop.py @@ -0,0 +1,958 @@ +"""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, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Any, Dict, List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class MultiAttachGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class MultiAttachGlobals(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 + + +MultiAttachPriceInterval = Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", +] +r"""Billing interval (e.g. 'month', 'year').""" + + +class MultiAttachBasePriceTypedDict(TypedDict): + r"""Base price configuration for a plan.""" + + amount: float + r"""Base price amount for the plan.""" + interval: MultiAttachPriceInterval + r"""Billing interval (e.g. 'month', 'year').""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + + +class MultiAttachBasePrice(BaseModel): + r"""Base price configuration for a plan.""" + + amount: float + r"""Base price amount for the plan.""" + + interval: MultiAttachPriceInterval + 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 + + +MultiAttachResetInterval = 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 MultiAttachResetTypedDict(TypedDict): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + interval: MultiAttachResetInterval + 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 MultiAttachReset(BaseModel): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + interval: MultiAttachResetInterval + 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 + + +MultiAttachToTypedDict = TypeAliasType("MultiAttachToTypedDict", Union[float, str]) + + +MultiAttachTo = TypeAliasType("MultiAttachTo", Union[float, str]) + + +class MultiAttachTierTypedDict(TypedDict): + to: MultiAttachToTypedDict + amount: float + flat_amount: NotRequired[Nullable[float]] + + +class MultiAttachTier(BaseModel): + to: MultiAttachTo + + amount: float + + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +MultiAttachTierBehavior = Literal[ + "graduated", + "volume", +] + + +MultiAttachItemPriceInterval = Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", +] +r"""Billing interval. For consumable features, should match reset.interval.""" + + +MultiAttachBillingMethod = Literal[ + "prepaid", + "usage_based", +] +r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" + + +class MultiAttachPriceTypedDict(TypedDict): + r"""Pricing for usage beyond included units. Omit for free features.""" + + interval: MultiAttachItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" + billing_method: MultiAttachBillingMethod + 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[MultiAttachTierTypedDict]] + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + tier_behavior: NotRequired[MultiAttachTierBehavior] + 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 MultiAttachPrice(BaseModel): + r"""Pricing for usage beyond included units. Omit for free features.""" + + interval: MultiAttachItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" + + billing_method: MultiAttachBillingMethod + 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[MultiAttachTier]] = None + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + + tier_behavior: Optional[MultiAttachTierBehavior] = None + + 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", + "tier_behavior", + "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 + + +MultiAttachOnIncrease = Literal[ + "bill_immediately", + "prorate_immediately", + "prorate_next_cycle", + "bill_next_cycle", +] +r"""Billing behavior when quantity increases mid-cycle.""" + + +MultiAttachOnDecrease = Literal[ + "prorate", + "prorate_immediately", + "prorate_next_cycle", + "none", + "no_prorations", +] +r"""Credit behavior when quantity decreases mid-cycle.""" + + +class MultiAttachProrationTypedDict(TypedDict): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + on_increase: MultiAttachOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" + on_decrease: MultiAttachOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" + + +class MultiAttachProration(BaseModel): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + on_increase: MultiAttachOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" + + on_decrease: MultiAttachOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" + + +MultiAttachExpiryDurationType = Literal[ + "month", + "forever", +] +r"""When rolled over units expire.""" + + +class MultiAttachRolloverTypedDict(TypedDict): + r"""Rollover config for unused units. If set, unused included units carry over.""" + + expiry_duration_type: MultiAttachExpiryDurationType + 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 MultiAttachRollover(BaseModel): + r"""Rollover config for unused units. If set, unused included units carry over.""" + + expiry_duration_type: MultiAttachExpiryDurationType + 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 MultiAttachPlanItemTypedDict(TypedDict): + r"""Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings.""" + + 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[MultiAttachResetTypedDict] + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + price: NotRequired[MultiAttachPriceTypedDict] + r"""Pricing for usage beyond included units. Omit for free features.""" + proration: NotRequired[MultiAttachProrationTypedDict] + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + rollover: NotRequired[MultiAttachRolloverTypedDict] + r"""Rollover config for unused units. If set, unused included units carry over.""" + + +class MultiAttachPlanItem(BaseModel): + r"""Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings.""" + + 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[MultiAttachReset] = None + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + price: Optional[MultiAttachPrice] = None + r"""Pricing for usage beyond included units. Omit for free features.""" + + proration: Optional[MultiAttachProration] = None + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + rollover: Optional[MultiAttachRollover] = 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 + + +class MultiAttachCustomizeTypedDict(TypedDict): + r"""Customize the plan to attach. Can override the price or items.""" + + price: NotRequired[Nullable[MultiAttachBasePriceTypedDict]] + r"""Override the base price of the plan. Pass null to remove the base price.""" + items: NotRequired[List[MultiAttachPlanItemTypedDict]] + r"""Override the items in the plan.""" + + +class MultiAttachCustomize(BaseModel): + r"""Customize the plan to attach. Can override the price or items.""" + + price: OptionalNullable[MultiAttachBasePrice] = UNSET + r"""Override the base price of the plan. Pass null to remove the base price.""" + + items: Optional[List[MultiAttachPlanItem]] = None + r"""Override the items in the plan.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["price", "items"]) + nullable_fields = set(["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 + + +class MultiAttachFeatureQuantityTypedDict(TypedDict): + r"""Quantity configuration for a prepaid feature.""" + + feature_id: str + r"""The ID of the feature to set quantity for.""" + quantity: NotRequired[float] + r"""The quantity of the feature.""" + adjustable: NotRequired[bool] + r"""Whether the customer can adjust the quantity.""" + + +class MultiAttachFeatureQuantity(BaseModel): + r"""Quantity configuration for a prepaid feature.""" + + feature_id: str + r"""The ID of the feature to set quantity for.""" + + quantity: Optional[float] = None + r"""The quantity of the feature.""" + + adjustable: Optional[bool] = None + r"""Whether the customer can adjust the quantity.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["quantity", "adjustable"]) + 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 MultiAttachPlanTypedDict(TypedDict): + plan_id: str + r"""The ID of the plan to attach.""" + customize: NotRequired[MultiAttachCustomizeTypedDict] + r"""Customize the plan to attach. Can override the price or items.""" + feature_quantities: NotRequired[List[MultiAttachFeatureQuantityTypedDict]] + r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature.""" + version: NotRequired[float] + r"""The version of the plan to attach.""" + + +class MultiAttachPlan(BaseModel): + plan_id: str + r"""The ID of the plan to attach.""" + + customize: Optional[MultiAttachCustomize] = None + r"""Customize the plan to attach. Can override the price or items.""" + + feature_quantities: Optional[List[MultiAttachFeatureQuantity]] = None + r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature.""" + + version: Optional[float] = None + r"""The version of the plan to attach.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["customize", "feature_quantities", "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 + + +MultiAttachDurationType = Literal[ + "day", + "month", + "year", +] +r"""Unit of time for the trial ('day', 'month', 'year').""" + + +class MultiAttachFreeTrialParamsTypedDict(TypedDict): + r"""Free trial configuration for a plan.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + duration_type: NotRequired[MultiAttachDurationType] + 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 MultiAttachFreeTrialParams(BaseModel): + r"""Free trial configuration for a plan.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + + duration_type: Optional[MultiAttachDurationType] = "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 MultiAttachInvoiceModeTypedDict(TypedDict): + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately.""" + + enabled: bool + r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.""" + enable_plan_immediately: NotRequired[bool] + r"""If true, enables the plan immediately even though the invoice is not paid yet.""" + finalize: NotRequired[bool] + r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.""" + + +class MultiAttachInvoiceMode(BaseModel): + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately.""" + + enabled: bool + r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.""" + + enable_plan_immediately: Optional[bool] = False + r"""If true, enables the plan immediately even though the invoice is not paid yet.""" + + finalize: Optional[bool] = True + r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["enable_plan_immediately", "finalize"]) + 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 MultiAttachAttachDiscountTypedDict(TypedDict): + r"""A discount to apply. Can be either a reward ID or a promotion code.""" + + reward_id: NotRequired[str] + r"""The ID of the reward to apply as a discount.""" + promotion_code: NotRequired[str] + r"""The promotion code to apply as a discount.""" + + +class MultiAttachAttachDiscount(BaseModel): + r"""A discount to apply. Can be either a reward ID or a promotion code.""" + + reward_id: Optional[str] = None + r"""The ID of the reward to apply as a discount.""" + + promotion_code: Optional[str] = None + r"""The promotion code to apply as a discount.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["reward_id", "promotion_code"]) + 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 + + +MultiAttachRedirectMode = Literal[ + "always", + "if_required", + "never", +] +r"""Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.""" + + +class MultiAttachEntityDataTypedDict(TypedDict): + feature_id: str + r"""The feature ID that this entity is associated with""" + name: NotRequired[str] + r"""Name of the entity""" + + +class MultiAttachEntityData(BaseModel): + feature_id: str + r"""The feature ID that this entity is associated with""" + + name: Optional[str] = None + r"""Name of the entity""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["name"]) + 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 MultiAttachParamsTypedDict(TypedDict): + customer_id: str + r"""The ID of the customer to attach the plans to.""" + plans: List[MultiAttachPlanTypedDict] + r"""The list of plans to attach to the customer.""" + entity_id: NotRequired[str] + r"""The ID of the entity to attach the plans to.""" + free_trial: NotRequired[Nullable[MultiAttachFreeTrialParamsTypedDict]] + r"""Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial.""" + invoice_mode: NotRequired[MultiAttachInvoiceModeTypedDict] + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately.""" + discounts: NotRequired[List[MultiAttachAttachDiscountTypedDict]] + r"""List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.""" + success_url: NotRequired[str] + r"""URL to redirect to after successful checkout.""" + checkout_session_params: NotRequired[Dict[str, Any]] + r"""Additional parameters to pass into the creation of the Stripe checkout session.""" + redirect_mode: NotRequired[MultiAttachRedirectMode] + r"""Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.""" + new_billing_subscription: NotRequired[bool] + r"""Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.""" + customer_data: NotRequired[CustomerDataTypedDict] + r"""Customer details to set when creating a customer""" + entity_data: NotRequired[MultiAttachEntityDataTypedDict] + + +class MultiAttachParams(BaseModel): + customer_id: str + r"""The ID of the customer to attach the plans to.""" + + plans: List[MultiAttachPlan] + r"""The list of plans to attach to the customer.""" + + entity_id: Optional[str] = None + r"""The ID of the entity to attach the plans to.""" + + free_trial: OptionalNullable[MultiAttachFreeTrialParams] = UNSET + r"""Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial.""" + + invoice_mode: Optional[MultiAttachInvoiceMode] = None + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately.""" + + discounts: Optional[List[MultiAttachAttachDiscount]] = None + r"""List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.""" + + success_url: Optional[str] = None + r"""URL to redirect to after successful checkout.""" + + checkout_session_params: Optional[Dict[str, Any]] = None + r"""Additional parameters to pass into the creation of the Stripe checkout session.""" + + redirect_mode: Optional[MultiAttachRedirectMode] = "if_required" + r"""Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.""" + + new_billing_subscription: Optional[bool] = None + r"""Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.""" + + customer_data: Optional[CustomerData] = None + r"""Customer details to set when creating a customer""" + + entity_data: Optional[MultiAttachEntityData] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "entity_id", + "free_trial", + "invoice_mode", + "discounts", + "success_url", + "checkout_session_params", + "redirect_mode", + "new_billing_subscription", + "customer_data", + "entity_data", + ] + ) + nullable_fields = set(["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 + + +class MultiAttachInvoiceTypedDict(TypedDict): + r"""Invoice details if an invoice was created. Only present when a charge was made.""" + + status: Nullable[str] + r"""The status of the invoice (e.g., 'paid', 'open', 'draft').""" + stripe_id: str + r"""The Stripe invoice ID.""" + total: float + r"""The total amount of the invoice in cents.""" + currency: str + r"""The three-letter ISO currency code (e.g., 'usd').""" + hosted_invoice_url: Nullable[str] + r"""URL to the hosted invoice page where the customer can view and pay the invoice.""" + + +class MultiAttachInvoice(BaseModel): + r"""Invoice details if an invoice was created. Only present when a charge was made.""" + + status: Nullable[str] + r"""The status of the invoice (e.g., 'paid', 'open', 'draft').""" + + stripe_id: str + r"""The Stripe invoice ID.""" + + total: float + r"""The total amount of the invoice in cents.""" + + currency: str + r"""The three-letter ISO currency code (e.g., 'usd').""" + + hosted_invoice_url: Nullable[str] + r"""URL to the hosted invoice page where the customer can view and pay the invoice.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + 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: + m[k] = val + + return m + + +MultiAttachCode = Union[ + Literal[ + "3ds_required", + "payment_method_required", + "payment_failed", + ], + UnrecognizedStr, +] +r"""The type of action required to complete the payment.""" + + +class MultiAttachRequiredActionTypedDict(TypedDict): + r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" + + code: MultiAttachCode + r"""The type of action required to complete the payment.""" + reason: str + r"""A human-readable explanation of why this action is required.""" + + +class MultiAttachRequiredAction(BaseModel): + r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" + + code: MultiAttachCode + r"""The type of action required to complete the payment.""" + + reason: str + r"""A human-readable explanation of why this action is required.""" + + +class MultiAttachResponseTypedDict(TypedDict): + r"""OK""" + + customer_id: str + r"""The ID of the customer.""" + payment_url: Nullable[str] + r"""URL to redirect the customer to complete payment. Null if no payment action is required.""" + entity_id: NotRequired[str] + r"""The ID of the entity, if the plan was attached to an entity.""" + invoice: NotRequired[MultiAttachInvoiceTypedDict] + r"""Invoice details if an invoice was created. Only present when a charge was made.""" + required_action: NotRequired[MultiAttachRequiredActionTypedDict] + r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" + + +class MultiAttachResponse(BaseModel): + r"""OK""" + + customer_id: str + r"""The ID of the customer.""" + + payment_url: Nullable[str] + r"""URL to redirect the customer to complete payment. Null if no payment action is required.""" + + entity_id: Optional[str] = None + r"""The ID of the entity, if the plan was attached to an entity.""" + + invoice: Optional[MultiAttachInvoice] = None + r"""Invoice details if an invoice was created. Only present when a charge was made.""" + + required_action: Optional[MultiAttachRequiredAction] = None + r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["entity_id", "invoice", "required_action"]) + nullable_fields = set(["payment_url"]) + 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/plan.py b/others/python-sdk/src/autumn_sdk/models/plan.py index 76e8c1505..67266550a 100644 --- a/others/python-sdk/src/autumn_sdk/models/plan.py +++ b/others/python-sdk/src/autumn_sdk/models/plan.py @@ -268,6 +268,7 @@ PlanTo = TypeAliasType("PlanTo", Union[float, str]) class PlanTierTypedDict(TypedDict): to: PlanToTypedDict amount: float + flat_amount: NotRequired[Nullable[float]] class PlanTier(BaseModel): @@ -275,6 +276,42 @@ class PlanTier(BaseModel): amount: float + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +PlanTierBehavior = Union[ + Literal[ + "graduated", + "volume", + ], + UnrecognizedStr, +] + PlanPriceItemInterval = Union[ Literal[ @@ -312,7 +349,8 @@ class PlanItemPriceTypedDict(TypedDict): 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.""" + r"""Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.""" + tier_behavior: NotRequired[PlanTierBehavior] interval_count: NotRequired[float] r"""Number of intervals per billing cycle. Defaults to 1.""" @@ -334,14 +372,16 @@ class PlanItemPrice(BaseModel): 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.""" + r"""Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.""" + + tier_behavior: Optional[PlanTierBehavior] = None 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"]) + optional_fields = set(["amount", "tiers", "tier_behavior", "interval_count"]) nullable_fields = set(["max_purchase"]) serialized = handler(self) m = {} @@ -574,6 +614,54 @@ PlanEnv = Union[ r"""Environment this plan belongs to ('sandbox' or 'live').""" +Scenario = Union[ + Literal[ + "scheduled", + "active", + "new", + "renew", + "upgrade", + "downgrade", + "cancel", + "expired", + "past_due", + ], + UnrecognizedStr, +] +r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + + +class CustomerEligibilityTypedDict(TypedDict): + scenario: Scenario + r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + trial_available: NotRequired[bool] + r"""Whether a free trial is available for this customer.""" + + +class CustomerEligibility(BaseModel): + scenario: Scenario + r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + + trial_available: Optional[bool] = None + r"""Whether a free trial is available for this customer.""" + + @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 + + class PlanTypedDict(TypedDict): id: str r"""Unique identifier for the plan.""" @@ -603,6 +691,7 @@ class PlanTypedDict(TypedDict): r"""If this is a variant, the ID of the base plan it was created from.""" free_trial: NotRequired[FreeTrialTypedDict] r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + customer_eligibility: NotRequired[CustomerEligibilityTypedDict] class Plan(BaseModel): @@ -648,9 +737,11 @@ class Plan(BaseModel): free_trial: Optional[FreeTrial] = None r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + customer_eligibility: Optional[CustomerEligibility] = None + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["free_trial"]) + optional_fields = set(["free_trial", "customer_eligibility"]) 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 085ab6238..4b61a868a 100644 --- a/others/python-sdk/src/autumn_sdk/models/previewattachop.py +++ b/others/python-sdk/src/autumn_sdk/models/previewattachop.py @@ -11,7 +11,7 @@ from autumn_sdk.types import ( from autumn_sdk.utils import FieldMetadata, HeaderMetadata import pydantic from pydantic import model_serializer -from typing import List, Literal, Optional, Union +from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict @@ -192,6 +192,7 @@ PreviewAttachTo = TypeAliasType("PreviewAttachTo", Union[float, str]) class PreviewAttachTierTypedDict(TypedDict): to: PreviewAttachToTypedDict amount: float + flat_amount: NotRequired[Nullable[float]] class PreviewAttachTier(BaseModel): @@ -199,6 +200,39 @@ class PreviewAttachTier(BaseModel): amount: float + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +PreviewAttachTierBehavior = Literal[ + "graduated", + "volume", +] + PreviewAttachItemPriceInterval = Literal[ "one_off", @@ -228,7 +262,8 @@ class PreviewAttachPriceTypedDict(TypedDict): 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.""" + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + tier_behavior: NotRequired[PreviewAttachTierBehavior] interval_count: NotRequired[float] r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: NotRequired[float] @@ -250,7 +285,9 @@ class PreviewAttachPrice(BaseModel): 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.""" + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + + tier_behavior: Optional[PreviewAttachTierBehavior] = None interval_count: Optional[float] = 1 r"""Number of intervals per billing cycle. Defaults to 1.""" @@ -264,7 +301,14 @@ class PreviewAttachPrice(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["amount", "tiers", "interval_count", "billing_units", "max_purchase"] + [ + "amount", + "tiers", + "tier_behavior", + "interval_count", + "billing_units", + "max_purchase", + ] ) serialized = handler(self) m = {} @@ -638,6 +682,8 @@ class PreviewAttachParamsTypedDict(TypedDict): r"""Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.""" plan_schedule: NotRequired[PreviewAttachPlanSchedule] r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.""" + checkout_session_params: NotRequired[Dict[str, Any]] + r"""Additional parameters to pass into the creation of the Stripe checkout session.""" class PreviewAttachParams(BaseModel): @@ -677,6 +723,9 @@ class PreviewAttachParams(BaseModel): plan_schedule: Optional[PreviewAttachPlanSchedule] = None r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.""" + checkout_session_params: Optional[Dict[str, Any]] = None + r"""Additional parameters to pass into the creation of the Stripe checkout session.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( @@ -691,6 +740,7 @@ class PreviewAttachParams(BaseModel): "success_url", "new_billing_subscription", "plan_schedule", + "checkout_session_params", ] ) serialized = handler(self) diff --git a/others/python-sdk/src/autumn_sdk/models/previewmultiattachop.py b/others/python-sdk/src/autumn_sdk/models/previewmultiattachop.py new file mode 100644 index 000000000..5ef6648c7 --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/previewmultiattachop.py @@ -0,0 +1,973 @@ +"""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, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Any, Dict, List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class PreviewMultiAttachGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class PreviewMultiAttachGlobals(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 + + +PreviewMultiAttachPriceInterval = Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", +] +r"""Billing interval (e.g. 'month', 'year').""" + + +class PreviewMultiAttachBasePriceTypedDict(TypedDict): + r"""Base price configuration for a plan.""" + + amount: float + r"""Base price amount for the plan.""" + interval: PreviewMultiAttachPriceInterval + r"""Billing interval (e.g. 'month', 'year').""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + + +class PreviewMultiAttachBasePrice(BaseModel): + r"""Base price configuration for a plan.""" + + amount: float + r"""Base price amount for the plan.""" + + interval: PreviewMultiAttachPriceInterval + 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 + + +PreviewMultiAttachResetInterval = 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 PreviewMultiAttachResetTypedDict(TypedDict): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + interval: PreviewMultiAttachResetInterval + 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 PreviewMultiAttachReset(BaseModel): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + interval: PreviewMultiAttachResetInterval + 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 + + +PreviewMultiAttachToTypedDict = TypeAliasType( + "PreviewMultiAttachToTypedDict", Union[float, str] +) + + +PreviewMultiAttachTo = TypeAliasType("PreviewMultiAttachTo", Union[float, str]) + + +class PreviewMultiAttachTierTypedDict(TypedDict): + to: PreviewMultiAttachToTypedDict + amount: float + flat_amount: NotRequired[Nullable[float]] + + +class PreviewMultiAttachTier(BaseModel): + to: PreviewMultiAttachTo + + amount: float + + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +PreviewMultiAttachTierBehavior = Literal[ + "graduated", + "volume", +] + + +PreviewMultiAttachItemPriceInterval = Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", +] +r"""Billing interval. For consumable features, should match reset.interval.""" + + +PreviewMultiAttachBillingMethod = Literal[ + "prepaid", + "usage_based", +] +r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" + + +class PreviewMultiAttachPriceTypedDict(TypedDict): + r"""Pricing for usage beyond included units. Omit for free features.""" + + interval: PreviewMultiAttachItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" + billing_method: PreviewMultiAttachBillingMethod + 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[PreviewMultiAttachTierTypedDict]] + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + tier_behavior: NotRequired[PreviewMultiAttachTierBehavior] + 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 PreviewMultiAttachPrice(BaseModel): + r"""Pricing for usage beyond included units. Omit for free features.""" + + interval: PreviewMultiAttachItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" + + billing_method: PreviewMultiAttachBillingMethod + 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[PreviewMultiAttachTier]] = None + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + + tier_behavior: Optional[PreviewMultiAttachTierBehavior] = None + + 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", + "tier_behavior", + "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 + + +PreviewMultiAttachOnIncrease = Literal[ + "bill_immediately", + "prorate_immediately", + "prorate_next_cycle", + "bill_next_cycle", +] +r"""Billing behavior when quantity increases mid-cycle.""" + + +PreviewMultiAttachOnDecrease = Literal[ + "prorate", + "prorate_immediately", + "prorate_next_cycle", + "none", + "no_prorations", +] +r"""Credit behavior when quantity decreases mid-cycle.""" + + +class PreviewMultiAttachProrationTypedDict(TypedDict): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + on_increase: PreviewMultiAttachOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" + on_decrease: PreviewMultiAttachOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" + + +class PreviewMultiAttachProration(BaseModel): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + on_increase: PreviewMultiAttachOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" + + on_decrease: PreviewMultiAttachOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" + + +PreviewMultiAttachExpiryDurationType = Literal[ + "month", + "forever", +] +r"""When rolled over units expire.""" + + +class PreviewMultiAttachRolloverTypedDict(TypedDict): + r"""Rollover config for unused units. If set, unused included units carry over.""" + + expiry_duration_type: PreviewMultiAttachExpiryDurationType + 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 PreviewMultiAttachRollover(BaseModel): + r"""Rollover config for unused units. If set, unused included units carry over.""" + + expiry_duration_type: PreviewMultiAttachExpiryDurationType + 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 PreviewMultiAttachPlanItemTypedDict(TypedDict): + r"""Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings.""" + + 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[PreviewMultiAttachResetTypedDict] + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + price: NotRequired[PreviewMultiAttachPriceTypedDict] + r"""Pricing for usage beyond included units. Omit for free features.""" + proration: NotRequired[PreviewMultiAttachProrationTypedDict] + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + rollover: NotRequired[PreviewMultiAttachRolloverTypedDict] + r"""Rollover config for unused units. If set, unused included units carry over.""" + + +class PreviewMultiAttachPlanItem(BaseModel): + r"""Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings.""" + + 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[PreviewMultiAttachReset] = None + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + price: Optional[PreviewMultiAttachPrice] = None + r"""Pricing for usage beyond included units. Omit for free features.""" + + proration: Optional[PreviewMultiAttachProration] = None + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + rollover: Optional[PreviewMultiAttachRollover] = 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 + + +class PreviewMultiAttachCustomizeTypedDict(TypedDict): + r"""Customize the plan to attach. Can override the price or items.""" + + price: NotRequired[Nullable[PreviewMultiAttachBasePriceTypedDict]] + r"""Override the base price of the plan. Pass null to remove the base price.""" + items: NotRequired[List[PreviewMultiAttachPlanItemTypedDict]] + r"""Override the items in the plan.""" + + +class PreviewMultiAttachCustomize(BaseModel): + r"""Customize the plan to attach. Can override the price or items.""" + + price: OptionalNullable[PreviewMultiAttachBasePrice] = UNSET + r"""Override the base price of the plan. Pass null to remove the base price.""" + + items: Optional[List[PreviewMultiAttachPlanItem]] = None + r"""Override the items in the plan.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["price", "items"]) + nullable_fields = set(["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 + + +class PreviewMultiAttachFeatureQuantityTypedDict(TypedDict): + r"""Quantity configuration for a prepaid feature.""" + + feature_id: str + r"""The ID of the feature to set quantity for.""" + quantity: NotRequired[float] + r"""The quantity of the feature.""" + adjustable: NotRequired[bool] + r"""Whether the customer can adjust the quantity.""" + + +class PreviewMultiAttachFeatureQuantity(BaseModel): + r"""Quantity configuration for a prepaid feature.""" + + feature_id: str + r"""The ID of the feature to set quantity for.""" + + quantity: Optional[float] = None + r"""The quantity of the feature.""" + + adjustable: Optional[bool] = None + r"""Whether the customer can adjust the quantity.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["quantity", "adjustable"]) + 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 PreviewMultiAttachPlanTypedDict(TypedDict): + plan_id: str + r"""The ID of the plan to attach.""" + customize: NotRequired[PreviewMultiAttachCustomizeTypedDict] + r"""Customize the plan to attach. Can override the price or items.""" + feature_quantities: NotRequired[List[PreviewMultiAttachFeatureQuantityTypedDict]] + r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature.""" + version: NotRequired[float] + r"""The version of the plan to attach.""" + + +class PreviewMultiAttachPlan(BaseModel): + plan_id: str + r"""The ID of the plan to attach.""" + + customize: Optional[PreviewMultiAttachCustomize] = None + r"""Customize the plan to attach. Can override the price or items.""" + + feature_quantities: Optional[List[PreviewMultiAttachFeatureQuantity]] = None + r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature.""" + + version: Optional[float] = None + r"""The version of the plan to attach.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["customize", "feature_quantities", "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 + + +PreviewMultiAttachDurationType = Literal[ + "day", + "month", + "year", +] +r"""Unit of time for the trial ('day', 'month', 'year').""" + + +class PreviewMultiAttachFreeTrialParamsTypedDict(TypedDict): + r"""Free trial configuration for a plan.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + duration_type: NotRequired[PreviewMultiAttachDurationType] + 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 PreviewMultiAttachFreeTrialParams(BaseModel): + r"""Free trial configuration for a plan.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + + duration_type: Optional[PreviewMultiAttachDurationType] = "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 PreviewMultiAttachInvoiceModeTypedDict(TypedDict): + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately.""" + + enabled: bool + r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.""" + enable_plan_immediately: NotRequired[bool] + r"""If true, enables the plan immediately even though the invoice is not paid yet.""" + finalize: NotRequired[bool] + r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.""" + + +class PreviewMultiAttachInvoiceMode(BaseModel): + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately.""" + + enabled: bool + r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.""" + + enable_plan_immediately: Optional[bool] = False + r"""If true, enables the plan immediately even though the invoice is not paid yet.""" + + finalize: Optional[bool] = True + r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["enable_plan_immediately", "finalize"]) + 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 PreviewMultiAttachAttachDiscountTypedDict(TypedDict): + r"""A discount to apply. Can be either a reward ID or a promotion code.""" + + reward_id: NotRequired[str] + r"""The ID of the reward to apply as a discount.""" + promotion_code: NotRequired[str] + r"""The promotion code to apply as a discount.""" + + +class PreviewMultiAttachAttachDiscount(BaseModel): + r"""A discount to apply. Can be either a reward ID or a promotion code.""" + + reward_id: Optional[str] = None + r"""The ID of the reward to apply as a discount.""" + + promotion_code: Optional[str] = None + r"""The promotion code to apply as a discount.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["reward_id", "promotion_code"]) + 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 + + +PreviewMultiAttachRedirectMode = Literal[ + "always", + "if_required", + "never", +] +r"""Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.""" + + +class PreviewMultiAttachEntityDataTypedDict(TypedDict): + feature_id: str + r"""The feature ID that this entity is associated with""" + name: NotRequired[str] + r"""Name of the entity""" + + +class PreviewMultiAttachEntityData(BaseModel): + feature_id: str + r"""The feature ID that this entity is associated with""" + + name: Optional[str] = None + r"""Name of the entity""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["name"]) + 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 PreviewMultiAttachParamsTypedDict(TypedDict): + customer_id: str + r"""The ID of the customer to attach the plans to.""" + plans: List[PreviewMultiAttachPlanTypedDict] + r"""The list of plans to attach to the customer.""" + entity_id: NotRequired[str] + r"""The ID of the entity to attach the plans to.""" + free_trial: NotRequired[Nullable[PreviewMultiAttachFreeTrialParamsTypedDict]] + r"""Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial.""" + invoice_mode: NotRequired[PreviewMultiAttachInvoiceModeTypedDict] + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately.""" + discounts: NotRequired[List[PreviewMultiAttachAttachDiscountTypedDict]] + r"""List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.""" + success_url: NotRequired[str] + r"""URL to redirect to after successful checkout.""" + checkout_session_params: NotRequired[Dict[str, Any]] + r"""Additional parameters to pass into the creation of the Stripe checkout session.""" + redirect_mode: NotRequired[PreviewMultiAttachRedirectMode] + r"""Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.""" + new_billing_subscription: NotRequired[bool] + r"""Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.""" + customer_data: NotRequired[CustomerDataTypedDict] + r"""Customer details to set when creating a customer""" + entity_data: NotRequired[PreviewMultiAttachEntityDataTypedDict] + + +class PreviewMultiAttachParams(BaseModel): + customer_id: str + r"""The ID of the customer to attach the plans to.""" + + plans: List[PreviewMultiAttachPlan] + r"""The list of plans to attach to the customer.""" + + entity_id: Optional[str] = None + r"""The ID of the entity to attach the plans to.""" + + free_trial: OptionalNullable[PreviewMultiAttachFreeTrialParams] = UNSET + r"""Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial.""" + + invoice_mode: Optional[PreviewMultiAttachInvoiceMode] = None + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately.""" + + discounts: Optional[List[PreviewMultiAttachAttachDiscount]] = None + r"""List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.""" + + success_url: Optional[str] = None + r"""URL to redirect to after successful checkout.""" + + checkout_session_params: Optional[Dict[str, Any]] = None + r"""Additional parameters to pass into the creation of the Stripe checkout session.""" + + redirect_mode: Optional[PreviewMultiAttachRedirectMode] = "if_required" + r"""Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.""" + + new_billing_subscription: Optional[bool] = None + r"""Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.""" + + customer_data: Optional[CustomerData] = None + r"""Customer details to set when creating a customer""" + + entity_data: Optional[PreviewMultiAttachEntityData] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "entity_id", + "free_trial", + "invoice_mode", + "discounts", + "success_url", + "checkout_session_params", + "redirect_mode", + "new_billing_subscription", + "customer_data", + "entity_data", + ] + ) + nullable_fields = set(["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 + + +class PreviewMultiAttachDiscountTypedDict(TypedDict): + amount_off: float + percent_off: NotRequired[float] + stripe_coupon_id: NotRequired[str] + coupon_name: NotRequired[str] + + +class PreviewMultiAttachDiscount(BaseModel): + amount_off: Annotated[float, pydantic.Field(alias="amountOff")] + + percent_off: Annotated[Optional[float], pydantic.Field(alias="percentOff")] = None + + stripe_coupon_id: Annotated[ + Optional[str], pydantic.Field(alias="stripeCouponId") + ] = None + + coupon_name: Annotated[Optional[str], pydantic.Field(alias="couponName")] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["percentOff", "stripeCouponId", "couponName"]) + 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 PreviewMultiAttachLineItemTypedDict(TypedDict): + title: str + r"""The title of the line item.""" + description: str + r"""A detailed description of the line item.""" + amount: float + r"""The amount in cents for this line item.""" + discounts: NotRequired[List[PreviewMultiAttachDiscountTypedDict]] + r"""List of discounts applied to this line item.""" + + +class PreviewMultiAttachLineItem(BaseModel): + title: str + r"""The title of the line item.""" + + description: str + r"""A detailed description of the line item.""" + + amount: float + r"""The amount in cents for this line item.""" + + discounts: Optional[List[PreviewMultiAttachDiscount]] = None + r"""List of discounts applied to this line item.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["discounts"]) + 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 PreviewMultiAttachNextCycleTypedDict(TypedDict): + r"""Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles.""" + + starts_at: float + r"""Unix timestamp (milliseconds) when the next billing cycle starts.""" + total: float + r"""The total amount in cents for the next cycle.""" + + +class PreviewMultiAttachNextCycle(BaseModel): + r"""Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles.""" + + starts_at: float + r"""Unix timestamp (milliseconds) when the next billing cycle starts.""" + + total: float + r"""The total amount in cents for the next cycle.""" + + +class PreviewMultiAttachResponseTypedDict(TypedDict): + r"""OK""" + + customer_id: str + r"""The ID of the customer.""" + line_items: List[PreviewMultiAttachLineItemTypedDict] + r"""List of line items for the current billing period.""" + total: float + r"""The total amount in cents for the current billing period.""" + currency: str + r"""The three-letter ISO currency code (e.g., 'usd').""" + next_cycle: NotRequired[PreviewMultiAttachNextCycleTypedDict] + r"""Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles.""" + + +class PreviewMultiAttachResponse(BaseModel): + r"""OK""" + + customer_id: str + r"""The ID of the customer.""" + + line_items: List[PreviewMultiAttachLineItem] + r"""List of line items for the current billing period.""" + + total: float + r"""The total amount in cents for the current billing period.""" + + currency: str + r"""The three-letter ISO currency code (e.g., 'usd').""" + + next_cycle: Optional[PreviewMultiAttachNextCycle] = None + r"""Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["next_cycle"]) + 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 + + +try: + PreviewMultiAttachDiscount.model_rebuild() +except NameError: + pass diff --git a/others/python-sdk/src/autumn_sdk/models/previewupdateop.py b/others/python-sdk/src/autumn_sdk/models/previewupdateop.py index 1bcbcafa4..facd7b91f 100644 --- a/others/python-sdk/src/autumn_sdk/models/previewupdateop.py +++ b/others/python-sdk/src/autumn_sdk/models/previewupdateop.py @@ -192,6 +192,7 @@ PreviewUpdateTo = TypeAliasType("PreviewUpdateTo", Union[float, str]) class PreviewUpdateTierTypedDict(TypedDict): to: PreviewUpdateToTypedDict amount: float + flat_amount: NotRequired[Nullable[float]] class PreviewUpdateTier(BaseModel): @@ -199,6 +200,39 @@ class PreviewUpdateTier(BaseModel): amount: float + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +PreviewUpdateTierBehavior = Literal[ + "graduated", + "volume", +] + PreviewUpdateItemPriceInterval = Literal[ "one_off", @@ -228,7 +262,8 @@ class PreviewUpdatePriceTypedDict(TypedDict): 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.""" + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + tier_behavior: NotRequired[PreviewUpdateTierBehavior] interval_count: NotRequired[float] r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: NotRequired[float] @@ -250,7 +285,9 @@ class PreviewUpdatePrice(BaseModel): 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.""" + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + + tier_behavior: Optional[PreviewUpdateTierBehavior] = None interval_count: Optional[float] = 1 r"""Number of intervals per billing cycle. Defaults to 1.""" @@ -264,7 +301,14 @@ class PreviewUpdatePrice(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["amount", "tiers", "interval_count", "billing_units", "max_purchase"] + [ + "amount", + "tiers", + "tier_behavior", + "interval_count", + "billing_units", + "max_purchase", + ] ) serialized = handler(self) m = {} diff --git a/others/python-sdk/src/autumn_sdk/models/setuppaymentop.py b/others/python-sdk/src/autumn_sdk/models/setuppaymentop.py index 9ae3881ae..b9c38d784 100644 --- a/others/python-sdk/src/autumn_sdk/models/setuppaymentop.py +++ b/others/python-sdk/src/autumn_sdk/models/setuppaymentop.py @@ -1,13 +1,18 @@ """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.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + 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 +from typing import Any, Dict, List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict class SetupPaymentGlobalsTypedDict(TypedDict): @@ -38,34 +43,641 @@ class SetupPaymentGlobals(BaseModel): 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 SetupPaymentFeatureQuantityTypedDict(TypedDict): + r"""Quantity configuration for a prepaid feature.""" + + feature_id: str + r"""The ID of the feature to set quantity for.""" + quantity: NotRequired[float] + r"""The quantity of the feature.""" + adjustable: NotRequired[bool] + r"""Whether the customer can adjust the quantity.""" -class SetupPaymentParams(BaseModel): - customer_id: str - r"""The ID of the customer""" +class SetupPaymentFeatureQuantity(BaseModel): + r"""Quantity configuration for a prepaid feature.""" - success_url: Optional[str] = None - r"""URL to redirect to after successful payment setup. Must start with either http:// or https://""" + feature_id: str + r"""The ID of the feature to set quantity for.""" - customer_data: Optional[CustomerData] = None - r"""Customer details to set when creating a customer""" + quantity: Optional[float] = None + r"""The quantity of the feature.""" - checkout_session_params: Optional[Dict[str, Any]] = None - r"""Additional parameters for the checkout session""" + adjustable: Optional[bool] = None + r"""Whether the customer can adjust the quantity.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["quantity", "adjustable"]) + 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 + + +SetupPaymentPriceInterval = Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", +] +r"""Billing interval (e.g. 'month', 'year').""" + + +class SetupPaymentBasePriceTypedDict(TypedDict): + r"""Base price configuration for a plan.""" + + amount: float + r"""Base price amount for the plan.""" + interval: SetupPaymentPriceInterval + r"""Billing interval (e.g. 'month', 'year').""" + interval_count: NotRequired[float] + r"""Number of intervals per billing cycle. Defaults to 1.""" + + +class SetupPaymentBasePrice(BaseModel): + r"""Base price configuration for a plan.""" + + amount: float + r"""Base price amount for the plan.""" + + interval: SetupPaymentPriceInterval + 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 + + +SetupPaymentResetInterval = 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 SetupPaymentResetTypedDict(TypedDict): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + interval: SetupPaymentResetInterval + 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 SetupPaymentReset(BaseModel): + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + interval: SetupPaymentResetInterval + 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 + + +SetupPaymentToTypedDict = TypeAliasType("SetupPaymentToTypedDict", Union[float, str]) + + +SetupPaymentTo = TypeAliasType("SetupPaymentTo", Union[float, str]) + + +class SetupPaymentTierTypedDict(TypedDict): + to: SetupPaymentToTypedDict + amount: float + flat_amount: NotRequired[Nullable[float]] + + +class SetupPaymentTier(BaseModel): + to: SetupPaymentTo + + amount: float + + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +SetupPaymentTierBehavior = Literal[ + "graduated", + "volume", +] + + +SetupPaymentItemPriceInterval = Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", +] +r"""Billing interval. For consumable features, should match reset.interval.""" + + +SetupPaymentBillingMethod = Literal[ + "prepaid", + "usage_based", +] +r"""'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.""" + + +class SetupPaymentPriceTypedDict(TypedDict): + r"""Pricing for usage beyond included units. Omit for free features.""" + + interval: SetupPaymentItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" + billing_method: SetupPaymentBillingMethod + 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[SetupPaymentTierTypedDict]] + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + tier_behavior: NotRequired[SetupPaymentTierBehavior] + 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 SetupPaymentPrice(BaseModel): + r"""Pricing for usage beyond included units. Omit for free features.""" + + interval: SetupPaymentItemPriceInterval + r"""Billing interval. For consumable features, should match reset.interval.""" + + billing_method: SetupPaymentBillingMethod + 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[SetupPaymentTier]] = None + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + + tier_behavior: Optional[SetupPaymentTierBehavior] = None + + 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( - ["success_url", "customer_data", "checkout_session_params"] + [ + "amount", + "tiers", + "tier_behavior", + "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 + + +SetupPaymentOnIncrease = Literal[ + "bill_immediately", + "prorate_immediately", + "prorate_next_cycle", + "bill_next_cycle", +] +r"""Billing behavior when quantity increases mid-cycle.""" + + +SetupPaymentOnDecrease = Literal[ + "prorate", + "prorate_immediately", + "prorate_next_cycle", + "none", + "no_prorations", +] +r"""Credit behavior when quantity decreases mid-cycle.""" + + +class SetupPaymentProrationTypedDict(TypedDict): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + on_increase: SetupPaymentOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" + on_decrease: SetupPaymentOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" + + +class SetupPaymentProration(BaseModel): + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + on_increase: SetupPaymentOnIncrease + r"""Billing behavior when quantity increases mid-cycle.""" + + on_decrease: SetupPaymentOnDecrease + r"""Credit behavior when quantity decreases mid-cycle.""" + + +SetupPaymentExpiryDurationType = Literal[ + "month", + "forever", +] +r"""When rolled over units expire.""" + + +class SetupPaymentRolloverTypedDict(TypedDict): + r"""Rollover config for unused units. If set, unused included units carry over.""" + + expiry_duration_type: SetupPaymentExpiryDurationType + 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 SetupPaymentRollover(BaseModel): + r"""Rollover config for unused units. If set, unused included units carry over.""" + + expiry_duration_type: SetupPaymentExpiryDurationType + 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 SetupPaymentPlanItemTypedDict(TypedDict): + r"""Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings.""" + + 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[SetupPaymentResetTypedDict] + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + price: NotRequired[SetupPaymentPriceTypedDict] + r"""Pricing for usage beyond included units. Omit for free features.""" + proration: NotRequired[SetupPaymentProrationTypedDict] + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + rollover: NotRequired[SetupPaymentRolloverTypedDict] + r"""Rollover config for unused units. If set, unused included units carry over.""" + + +class SetupPaymentPlanItem(BaseModel): + r"""Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings.""" + + 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[SetupPaymentReset] = None + r"""Reset configuration for consumable features. Omit for non-consumable features like seats.""" + + price: Optional[SetupPaymentPrice] = None + r"""Pricing for usage beyond included units. Omit for free features.""" + + proration: Optional[SetupPaymentProration] = None + r"""Proration settings for prepaid features. Controls mid-cycle quantity change billing.""" + + rollover: Optional[SetupPaymentRollover] = 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 + + +SetupPaymentDurationType = Literal[ + "day", + "month", + "year", +] +r"""Unit of time for the trial ('day', 'month', 'year').""" + + +class SetupPaymentFreeTrialParamsTypedDict(TypedDict): + r"""Free trial configuration for a plan.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + duration_type: NotRequired[SetupPaymentDurationType] + 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 SetupPaymentFreeTrialParams(BaseModel): + r"""Free trial configuration for a plan.""" + + duration_length: float + r"""Number of duration_type periods the trial lasts.""" + + duration_type: Optional[SetupPaymentDurationType] = "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 SetupPaymentCustomizeTypedDict(TypedDict): + r"""Customize the plan to attach. Can override the price, items, free trial, or a combination.""" + + price: NotRequired[Nullable[SetupPaymentBasePriceTypedDict]] + r"""Override the base price of the plan. Pass null to remove the base price.""" + items: NotRequired[List[SetupPaymentPlanItemTypedDict]] + r"""Override the items in the plan.""" + free_trial: NotRequired[Nullable[SetupPaymentFreeTrialParamsTypedDict]] + r"""Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.""" + + +class SetupPaymentCustomize(BaseModel): + r"""Customize the plan to attach. Can override the price, items, free trial, or a combination.""" + + price: OptionalNullable[SetupPaymentBasePrice] = UNSET + r"""Override the base price of the plan. Pass null to remove the base price.""" + + items: Optional[List[SetupPaymentPlanItem]] = None + r"""Override the items in the plan.""" + + free_trial: OptionalNullable[SetupPaymentFreeTrialParams] = UNSET + r"""Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["price", "items", "free_trial"]) + 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 + + +SetupPaymentProrationBehavior = Literal[ + "prorate_immediately", + "none", +] +r"""How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges.""" + + +class SetupPaymentAttachDiscountTypedDict(TypedDict): + r"""A discount to apply. Can be either a reward ID or a promotion code.""" + + reward_id: NotRequired[str] + r"""The ID of the reward to apply as a discount.""" + promotion_code: NotRequired[str] + r"""The promotion code to apply as a discount.""" + + +class SetupPaymentAttachDiscount(BaseModel): + r"""A discount to apply. Can be either a reward ID or a promotion code.""" + + reward_id: Optional[str] = None + r"""The ID of the reward to apply as a discount.""" + + promotion_code: Optional[str] = None + r"""The promotion code to apply as a discount.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["reward_id", "promotion_code"]) + 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 to attach the plan to.""" + entity_id: NotRequired[str] + r"""The ID of the entity to attach the plan to.""" + plan_id: NotRequired[str] + r"""If specified, the plan will be attached to the customer after setup.""" + feature_quantities: NotRequired[List[SetupPaymentFeatureQuantityTypedDict]] + r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" + version: NotRequired[float] + r"""The version of the plan to attach.""" + customize: NotRequired[SetupPaymentCustomizeTypedDict] + r"""Customize the plan to attach. Can override the price, items, free trial, or a combination.""" + proration_behavior: NotRequired[SetupPaymentProrationBehavior] + r"""How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges.""" + discounts: NotRequired[List[SetupPaymentAttachDiscountTypedDict]] + r"""List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.""" + success_url: NotRequired[str] + r"""URL to redirect to after successful checkout.""" + checkout_session_params: NotRequired[Dict[str, Any]] + r"""Additional parameters to pass into the creation of the Stripe checkout session.""" + + +class SetupPaymentParams(BaseModel): + customer_id: str + r"""The ID of the customer to attach the plan to.""" + + entity_id: Optional[str] = None + r"""The ID of the entity to attach the plan to.""" + + plan_id: Optional[str] = None + r"""If specified, the plan will be attached to the customer after setup.""" + + feature_quantities: Optional[List[SetupPaymentFeatureQuantity]] = None + r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" + + version: Optional[float] = None + r"""The version of the plan to attach.""" + + customize: Optional[SetupPaymentCustomize] = None + r"""Customize the plan to attach. Can override the price, items, free trial, or a combination.""" + + proration_behavior: Optional[SetupPaymentProrationBehavior] = None + r"""How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges.""" + + discounts: Optional[List[SetupPaymentAttachDiscount]] = None + r"""List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.""" + + success_url: Optional[str] = None + r"""URL to redirect to after successful checkout.""" + + checkout_session_params: Optional[Dict[str, Any]] = None + r"""Additional parameters to pass into the creation of the Stripe checkout session.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "entity_id", + "plan_id", + "feature_quantities", + "version", + "customize", + "proration_behavior", + "discounts", + "success_url", + "checkout_session_params", + ] ) serialized = handler(self) m = {} @@ -87,7 +699,9 @@ class SetupPaymentResponseTypedDict(TypedDict): customer_id: str r"""The ID of the customer""" url: str - r"""URL to the payment setup page""" + r"""URL to redirect the customer to setup their payment.""" + entity_id: NotRequired[str] + r"""The ID of the entity the plan (if specified) will be attached to after setup.""" class SetupPaymentResponse(BaseModel): @@ -97,4 +711,23 @@ class SetupPaymentResponse(BaseModel): r"""The ID of the customer""" url: str - r"""URL to the payment setup page""" + r"""URL to redirect the customer to setup their payment.""" + + entity_id: Optional[str] = None + r"""The ID of the entity the plan (if specified) will be attached to after setup.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["entity_id"]) + 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 diff --git a/others/python-sdk/src/autumn_sdk/models/updatebalanceop.py b/others/python-sdk/src/autumn_sdk/models/updatebalanceop.py index 7f7e11503..debe6d192 100644 --- a/others/python-sdk/src/autumn_sdk/models/updatebalanceop.py +++ b/others/python-sdk/src/autumn_sdk/models/updatebalanceop.py @@ -62,6 +62,8 @@ class UpdateBalanceParamsTypedDict(TypedDict): r"""Set the remaining balance to this exact value. Cannot be combined with add_to_balance.""" add_to_balance: NotRequired[float] r"""Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance.""" + usage: NotRequired[float] + r"""The usage amount to update. Cannot be combined with remaining or add_to_balance.""" interval: NotRequired[UpdateBalanceInterval] r"""Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals.""" @@ -82,12 +84,17 @@ class UpdateBalanceParams(BaseModel): add_to_balance: Optional[float] = None r"""Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance.""" + usage: Optional[float] = None + r"""The usage amount to update. Cannot be combined with remaining or add_to_balance.""" + interval: Optional[UpdateBalanceInterval] = None r"""Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["entity_id", "remaining", "add_to_balance", "interval"]) + optional_fields = set( + ["entity_id", "remaining", "add_to_balance", "usage", "interval"] + ) serialized = handler(self) m = {} diff --git a/others/python-sdk/src/autumn_sdk/models/updateplanop.py b/others/python-sdk/src/autumn_sdk/models/updateplanop.py index f0dcfaafb..8a6db0744 100644 --- a/others/python-sdk/src/autumn_sdk/models/updateplanop.py +++ b/others/python-sdk/src/autumn_sdk/models/updateplanop.py @@ -155,6 +155,7 @@ UpdatePlanToRequest = TypeAliasType("UpdatePlanToRequest", Union[float, str]) class UpdatePlanTierRequestTypedDict(TypedDict): to: UpdatePlanToRequestTypedDict amount: float + flat_amount: NotRequired[Nullable[float]] class UpdatePlanTierRequest(BaseModel): @@ -162,6 +163,39 @@ class UpdatePlanTierRequest(BaseModel): amount: float + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +UpdatePlanTierBehaviorRequest = Literal[ + "graduated", + "volume", +] + UpdatePlanItemPriceIntervalRequest = Literal[ "one_off", @@ -191,7 +225,8 @@ class UpdatePlanPriceRequestTypedDict(TypedDict): 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.""" + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + tier_behavior: NotRequired[UpdatePlanTierBehaviorRequest] interval_count: NotRequired[float] r"""Number of intervals per billing cycle. Defaults to 1.""" billing_units: NotRequired[float] @@ -213,7 +248,9 @@ class UpdatePlanPriceRequest(BaseModel): 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.""" + r"""Tiered pricing. Either 'amount' or 'tiers' is required.""" + + tier_behavior: Optional[UpdatePlanTierBehaviorRequest] = None interval_count: Optional[float] = 1 r"""Number of intervals per billing cycle. Defaults to 1.""" @@ -227,7 +264,14 @@ class UpdatePlanPriceRequest(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["amount", "tiers", "interval_count", "billing_units", "max_purchase"] + [ + "amount", + "tiers", + "tier_behavior", + "interval_count", + "billing_units", + "max_purchase", + ] ) serialized = handler(self) m = {} @@ -792,6 +836,7 @@ UpdatePlanToResponse = TypeAliasType("UpdatePlanToResponse", Union[float, str]) class UpdatePlanTierResponseTypedDict(TypedDict): to: UpdatePlanToResponseTypedDict amount: float + flat_amount: NotRequired[Nullable[float]] class UpdatePlanTierResponse(BaseModel): @@ -799,6 +844,42 @@ class UpdatePlanTierResponse(BaseModel): amount: float + flat_amount: OptionalNullable[float] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["flat_amount"]) + nullable_fields = set(["flat_amount"]) + 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 + + +UpdatePlanTierBehaviorResponse = Union[ + Literal[ + "graduated", + "volume", + ], + UnrecognizedStr, +] + UpdatePlanPriceItemIntervalResponse = Union[ Literal[ @@ -836,7 +917,8 @@ class UpdatePlanItemPriceResponseTypedDict(TypedDict): 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.""" + r"""Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.""" + tier_behavior: NotRequired[UpdatePlanTierBehaviorResponse] interval_count: NotRequired[float] r"""Number of intervals per billing cycle. Defaults to 1.""" @@ -858,14 +940,16 @@ class UpdatePlanItemPriceResponse(BaseModel): 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.""" + r"""Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.""" + + tier_behavior: Optional[UpdatePlanTierBehaviorResponse] = None 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"]) + optional_fields = set(["amount", "tiers", "tier_behavior", "interval_count"]) nullable_fields = set(["max_purchase"]) serialized = handler(self) m = {} @@ -1098,6 +1182,54 @@ UpdatePlanEnv = Union[ r"""Environment this plan belongs to ('sandbox' or 'live').""" +UpdatePlanScenario = Union[ + Literal[ + "scheduled", + "active", + "new", + "renew", + "upgrade", + "downgrade", + "cancel", + "expired", + "past_due", + ], + UnrecognizedStr, +] +r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + + +class UpdatePlanCustomerEligibilityTypedDict(TypedDict): + scenario: UpdatePlanScenario + r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + trial_available: NotRequired[bool] + r"""Whether a free trial is available for this customer.""" + + +class UpdatePlanCustomerEligibility(BaseModel): + scenario: UpdatePlanScenario + r"""The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).""" + + trial_available: Optional[bool] = None + r"""Whether a free trial is available for this customer.""" + + @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 + + class UpdatePlanResponseTypedDict(TypedDict): r"""A plan defines a set of features, pricing, and entitlements that can be attached to customers.""" @@ -1129,6 +1261,7 @@ class UpdatePlanResponseTypedDict(TypedDict): r"""If this is a variant, the ID of the base plan it was created from.""" free_trial: NotRequired[UpdatePlanFreeTrialTypedDict] r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + customer_eligibility: NotRequired[UpdatePlanCustomerEligibilityTypedDict] class UpdatePlanResponse(BaseModel): @@ -1176,9 +1309,11 @@ class UpdatePlanResponse(BaseModel): free_trial: Optional[UpdatePlanFreeTrial] = None r"""Free trial configuration. If set, new customers can try this plan before being charged.""" + customer_eligibility: Optional[UpdatePlanCustomerEligibility] = None + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["free_trial"]) + optional_fields = set(["free_trial", "customer_eligibility"]) nullable_fields = set(["description", "group", "price", "base_variant_id"]) serialized = handler(self) m = {} diff --git a/packages/autumn-js/package.json b/packages/autumn-js/package.json index 3d8a6ca0b..2cef635d6 100644 --- a/packages/autumn-js/package.json +++ b/packages/autumn-js/package.json @@ -1,7 +1,7 @@ { "name": "autumn-js", "description": "Autumn JS Library", - "version": "1.0.0-beta.5", + "version": "1.0.0-beta.6", "repository": "github:useautumn/autumn", "homepage": "https://docs.useautumn.com", "main": "./dist/sdk/index.js", diff --git a/packages/autumn-js/src/backend/core/routes/routeConfigs.ts b/packages/autumn-js/src/backend/core/routes/routeConfigs.ts index d603b5245..a81480de4 100644 --- a/packages/autumn-js/src/backend/core/routes/routeConfigs.ts +++ b/packages/autumn-js/src/backend/core/routes/routeConfigs.ts @@ -84,6 +84,18 @@ export const routeConfigs: RouteDefinition[] = [ sdkMethod: (autumn, args) => autumn.referrals.redeemCode(args), bodySchema: redeemReferralCodeParamsSchema, }, + { + route: "multiAttach", + sdkMethod: (autumn, args) => autumn.billing.multiAttach(args), + }, + { + route: "previewMultiAttach", + sdkMethod: (autumn, args) => autumn.billing.previewMultiAttach(args), + }, + { + route: "setupPayment", + sdkMethod: (autumn, args) => autumn.billing.setupPayment(args), + }, { route: "listPlans", sdkMethod: (autumn, args) => autumn.plans.list(args), diff --git a/packages/autumn-js/src/backend/core/types/routeTypes.ts b/packages/autumn-js/src/backend/core/types/routeTypes.ts index 841517e4c..8219f5246 100644 --- a/packages/autumn-js/src/backend/core/types/routeTypes.ts +++ b/packages/autumn-js/src/backend/core/types/routeTypes.ts @@ -16,6 +16,9 @@ export const ROUTE_NAMES = { listPlans: "listPlans", listEvents: "listEvents", aggregateEvents: "aggregateEvents", + multiAttach: "multiAttach", + previewMultiAttach: "previewMultiAttach", + setupPayment: "setupPayment", } as const; /** Union of all route names */ diff --git a/packages/autumn-js/src/better-auth/index.ts b/packages/autumn-js/src/better-auth/index.ts index c2a7873f9..2d3d14e16 100644 --- a/packages/autumn-js/src/better-auth/index.ts +++ b/packages/autumn-js/src/better-auth/index.ts @@ -47,6 +47,9 @@ export function autumn(options: AutumnOptions = {}): AutumnPlugin { listPlans: createAutumnEndpoint("listPlans", handleRoute), listEvents: createAutumnEndpoint("listEvents", handleRoute), aggregateEvents: createAutumnEndpoint("aggregateEvents", handleRoute), + multiAttach: createAutumnEndpoint("multiAttach", handleRoute), + previewMultiAttach: createAutumnEndpoint("previewMultiAttach", handleRoute), + setupPayment: createAutumnEndpoint("setupPayment", handleRoute), }; return { diff --git a/packages/autumn-js/src/generated/attachSchemas.ts b/packages/autumn-js/src/generated/attachSchemas.ts new file mode 100644 index 000000000..5db50591e --- /dev/null +++ b/packages/autumn-js/src/generated/attachSchemas.ts @@ -0,0 +1,276 @@ +// Generated by ts-to-zod +import { z } from "zod/v4"; + +export const attachGlobalsSchema = z.object({ + xApiVersion: z.union([z.string(), z.undefined()]).optional(), +}); + +export const attachFeatureQuantitySchema = z.object({ + featureId: z.string(), + quantity: z.union([z.number(), z.undefined()]).optional(), + adjustable: z.union([z.boolean(), z.undefined()]).optional(), +}); + +export const attachToSchema = z.union([z.number(), z.string()]); + +export const attachTierSchema = z.object({ + to: z.union([z.number(), z.string()]), + amount: z.number(), + flatAmount: z.union([z.number(), z.undefined()]).optional().nullable(), +}); + +export const attachInvoiceModeSchema = z.object({ + enabled: z.boolean(), + enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(), + finalize: z.union([z.boolean(), z.undefined()]).optional(), +}); + +export const attachAttachDiscountSchema = z.object({ + rewardId: z.union([z.string(), z.undefined()]).optional(), + promotionCode: z.union([z.string(), z.undefined()]).optional(), +}); + +export const attachInvoiceSchema = z.object({ + status: z.string().nullable(), + stripeId: z.string(), + total: z.number(), + currency: z.string(), + hostedInvoiceUrl: z.string().nullable(), +}); + +export const attachFeatureQuantityOutboundSchema = z.object({ + feature_id: z.string(), + quantity: z.union([z.number(), z.undefined()]).optional(), + adjustable: z.union([z.boolean(), z.undefined()]).optional(), +}); + +export const attachBasePriceOutboundSchema = z.object({ + amount: z.number(), + interval: z.string(), + interval_count: z.union([z.number(), z.undefined()]).optional(), +}); + +export const attachResetOutboundSchema = z.object({ + interval: z.string(), + interval_count: z.union([z.number(), z.undefined()]).optional(), +}); + +export const attachToOutboundSchema = z.union([z.number(), z.string()]); + +export const attachTierOutboundSchema = z.object({ + to: z.union([z.number(), z.string()]), + amount: z.number(), + flat_amount: z.union([z.number(), z.undefined()]).optional().nullable(), +}); + +export const attachPriceOutboundSchema = z.object({ + amount: z.union([z.number(), z.undefined()]).optional(), + tiers: z.union([z.array(attachTierOutboundSchema), z.undefined()]).optional(), + tier_behavior: z.union([z.string(), z.undefined()]).optional(), + interval: z.string(), + interval_count: z.number(), + billing_units: z.number(), + billing_method: z.string(), + max_purchase: z.union([z.number(), z.undefined()]).optional(), +}); + +export const attachProrationOutboundSchema = z.object({ + on_increase: z.string(), + on_decrease: z.string(), +}); + +export const attachRolloverOutboundSchema = z.object({ + max: z.union([z.number(), z.undefined()]).optional(), + expiry_duration_type: z.string(), + expiry_duration_length: z.union([z.number(), z.undefined()]).optional(), +}); + +export const attachPlanItemOutboundSchema = z.object({ + feature_id: z.string(), + included: z.union([z.number(), z.undefined()]).optional(), + unlimited: z.union([z.boolean(), z.undefined()]).optional(), + reset: z.union([attachResetOutboundSchema, z.undefined()]).optional(), + price: z.union([attachPriceOutboundSchema, z.undefined()]).optional(), + proration: z.union([attachProrationOutboundSchema, z.undefined()]).optional(), + rollover: z.union([attachRolloverOutboundSchema, z.undefined()]).optional(), +}); + +export const attachFreeTrialParamsOutboundSchema = z.object({ + duration_length: z.number(), + duration_type: z.string(), + card_required: z.boolean(), +}); + +export const attachCustomizeOutboundSchema = z.object({ + price: z + .union([attachBasePriceOutboundSchema, z.undefined()]) + .optional() + .nullable(), + items: z + .union([z.array(attachPlanItemOutboundSchema), z.undefined()]) + .optional(), + free_trial: z + .union([attachFreeTrialParamsOutboundSchema, z.undefined()]) + .optional() + .nullable(), +}); + +export const attachInvoiceModeOutboundSchema = z.object({ + enabled: z.boolean(), + enable_plan_immediately: z.boolean(), + finalize: z.boolean(), +}); + +export const attachAttachDiscountOutboundSchema = z.object({ + reward_id: z.union([z.string(), z.undefined()]).optional(), + promotion_code: z.union([z.string(), z.undefined()]).optional(), +}); + +export const attachParamsOutboundSchema = z.object({ + customer_id: z.string(), + entity_id: z.union([z.string(), z.undefined()]).optional(), + plan_id: z.string(), + feature_quantities: z + .union([z.array(attachFeatureQuantityOutboundSchema), z.undefined()]) + .optional(), + version: z.union([z.number(), z.undefined()]).optional(), + customize: z.union([attachCustomizeOutboundSchema, z.undefined()]).optional(), + invoice_mode: z + .union([attachInvoiceModeOutboundSchema, z.undefined()]) + .optional(), + proration_behavior: z.union([z.string(), z.undefined()]).optional(), + discounts: z + .union([z.array(attachAttachDiscountOutboundSchema), z.undefined()]) + .optional(), + success_url: z.union([z.string(), z.undefined()]).optional(), + new_billing_subscription: z.union([z.boolean(), z.undefined()]).optional(), + plan_schedule: z.union([z.string(), z.undefined()]).optional(), + checkout_session_params: z + .union([z.record(z.string(), z.any()), z.undefined()]) + .optional(), +}); + +const closedEnumSchema = z.any(); + +const openEnumSchema = z.any(); + +export const attachPriceIntervalSchema = closedEnumSchema; + +export const attachBasePriceSchema = z.object({ + amount: z.number(), + interval: attachPriceIntervalSchema, + intervalCount: z.union([z.number(), z.undefined()]).optional(), +}); + +export const attachResetIntervalSchema = closedEnumSchema; + +export const attachResetSchema = z.object({ + interval: attachResetIntervalSchema, + intervalCount: z.union([z.number(), z.undefined()]).optional(), +}); + +export const attachTierBehaviorSchema = closedEnumSchema; + +export const attachItemPriceIntervalSchema = closedEnumSchema; + +export const attachBillingMethodSchema = closedEnumSchema; + +export const attachPriceSchema = z.object({ + amount: z.union([z.number(), z.undefined()]).optional(), + tiers: z.union([z.array(attachTierSchema), z.undefined()]).optional(), + tierBehavior: z.union([attachTierBehaviorSchema, z.undefined()]).optional(), + interval: attachItemPriceIntervalSchema, + intervalCount: z.union([z.number(), z.undefined()]).optional(), + billingUnits: z.union([z.number(), z.undefined()]).optional(), + billingMethod: attachBillingMethodSchema, + maxPurchase: z.union([z.number(), z.undefined()]).optional(), +}); + +export const attachOnIncreaseSchema = closedEnumSchema; + +export const attachOnDecreaseSchema = closedEnumSchema; + +export const attachProrationSchema = z.object({ + onIncrease: attachOnIncreaseSchema, + onDecrease: attachOnDecreaseSchema, +}); + +export const attachExpiryDurationTypeSchema = closedEnumSchema; + +export const attachRolloverSchema = z.object({ + max: z.union([z.number(), z.undefined()]).optional(), + expiryDurationType: attachExpiryDurationTypeSchema, + expiryDurationLength: z.union([z.number(), z.undefined()]).optional(), +}); + +export const attachPlanItemSchema = z.object({ + featureId: z.string(), + included: z.union([z.number(), z.undefined()]).optional(), + unlimited: z.union([z.boolean(), z.undefined()]).optional(), + reset: z.union([attachResetSchema, z.undefined()]).optional(), + price: z.union([attachPriceSchema, z.undefined()]).optional(), + proration: z.union([attachProrationSchema, z.undefined()]).optional(), + rollover: z.union([attachRolloverSchema, z.undefined()]).optional(), +}); + +export const attachDurationTypeSchema = closedEnumSchema; + +export const attachFreeTrialParamsSchema = z.object({ + durationLength: z.number(), + durationType: z.union([attachDurationTypeSchema, z.undefined()]).optional(), + cardRequired: z.union([z.boolean(), z.undefined()]).optional(), +}); + +export const attachCustomizeSchema = z.object({ + price: z.union([attachBasePriceSchema, z.undefined()]).optional().nullable(), + items: z.union([z.array(attachPlanItemSchema), z.undefined()]).optional(), + freeTrial: z + .union([attachFreeTrialParamsSchema, z.undefined()]) + .optional() + .nullable(), +}); + +export const attachProrationBehaviorSchema = closedEnumSchema; + +export const attachPlanScheduleSchema = closedEnumSchema; + +export const attachParamsSchema = z.object({ + customerId: z.string(), + entityId: z.union([z.string(), z.undefined()]).optional(), + planId: z.string(), + featureQuantities: z + .union([z.array(attachFeatureQuantitySchema), z.undefined()]) + .optional(), + version: z.union([z.number(), z.undefined()]).optional(), + customize: z.union([attachCustomizeSchema, z.undefined()]).optional(), + invoiceMode: z.union([attachInvoiceModeSchema, z.undefined()]).optional(), + prorationBehavior: z + .union([attachProrationBehaviorSchema, z.undefined()]) + .optional(), + discounts: z + .union([z.array(attachAttachDiscountSchema), z.undefined()]) + .optional(), + successUrl: z.union([z.string(), z.undefined()]).optional(), + newBillingSubscription: z.union([z.boolean(), z.undefined()]).optional(), + planSchedule: z.union([attachPlanScheduleSchema, z.undefined()]).optional(), + checkoutSessionParams: z + .union([z.record(z.string(), z.any()), z.undefined()]) + .optional(), +}); + +export const attachCodeSchema = openEnumSchema; + +export const attachRequiredActionSchema = z.object({ + code: attachCodeSchema, + reason: z.string(), +}); + +export const attachResponseSchema = z.object({ + customerId: z.string(), + entityId: z.union([z.string(), z.undefined()]).optional(), + invoice: z.union([attachInvoiceSchema, z.undefined()]).optional(), + paymentUrl: z.string().nullable(), + requiredAction: z + .union([attachRequiredActionSchema, z.undefined()]) + .optional(), +}); diff --git a/packages/autumn-js/src/generated/billingAttachSchemas.ts b/packages/autumn-js/src/generated/billingAttachSchemas.ts deleted file mode 100644 index 90e465511..000000000 --- a/packages/autumn-js/src/generated/billingAttachSchemas.ts +++ /dev/null @@ -1,283 +0,0 @@ -// Generated by ts-to-zod -import { z } from "zod/v4"; - -export const billingAttachGlobalsSchema = z.object({ - xApiVersion: z.union([z.string(), z.undefined()]).optional(), -}); - -export const billingAttachFeatureQuantitySchema = z.object({ - featureId: z.string(), - quantity: z.union([z.number(), z.undefined()]).optional(), - adjustable: z.union([z.boolean(), z.undefined()]).optional(), -}); - -export const billingAttachToSchema = z.union([z.number(), z.string()]); - -export const billingAttachTierSchema = z.object({ - to: z.union([z.number(), z.string()]), - amount: z.number(), -}); - -export const billingAttachInvoiceModeSchema = z.object({ - enabled: z.boolean(), - enablePlanImmediately: z.union([z.boolean(), z.undefined()]).optional(), - finalize: z.union([z.boolean(), z.undefined()]).optional(), -}); - -export const billingAttachAttachDiscountSchema = z.object({ - rewardId: z.union([z.string(), z.undefined()]).optional(), - promotionCode: z.union([z.string(), z.undefined()]).optional(), -}); - -export const billingAttachInvoiceSchema = z.object({ - status: z.string().nullable(), - stripeId: z.string(), - total: z.number(), - currency: z.string(), - hostedInvoiceUrl: z.string().nullable(), -}); - -export const billingAttachFeatureQuantityOutboundSchema = z.object({ - feature_id: z.string(), - quantity: z.union([z.number(), z.undefined()]).optional(), - adjustable: z.union([z.boolean(), z.undefined()]).optional(), -}); - -export const billingAttachBasePriceOutboundSchema = z.object({ - amount: z.number(), - interval: z.string(), - interval_count: z.union([z.number(), z.undefined()]).optional(), -}); - -export const billingAttachResetOutboundSchema = z.object({ - interval: z.string(), - interval_count: z.union([z.number(), z.undefined()]).optional(), -}); - -export const billingAttachToOutboundSchema = z.union([z.number(), z.string()]); - -export const billingAttachTierOutboundSchema = z.object({ - to: z.union([z.number(), z.string()]), - amount: z.number(), -}); - -export const billingAttachPriceOutboundSchema = z.object({ - amount: z.union([z.number(), z.undefined()]).optional(), - tiers: z - .union([z.array(billingAttachTierOutboundSchema), z.undefined()]) - .optional(), - interval: z.string(), - interval_count: z.number(), - billing_units: z.number(), - billing_method: z.string(), - max_purchase: z.union([z.number(), z.undefined()]).optional(), -}); - -export const billingAttachProrationOutboundSchema = z.object({ - on_increase: z.string(), - on_decrease: z.string(), -}); - -export const billingAttachRolloverOutboundSchema = z.object({ - max: z.union([z.number(), z.undefined()]).optional(), - expiry_duration_type: z.string(), - expiry_duration_length: z.union([z.number(), z.undefined()]).optional(), -}); - -export const billingAttachPlanItemOutboundSchema = z.object({ - feature_id: z.string(), - included: z.union([z.number(), z.undefined()]).optional(), - unlimited: z.union([z.boolean(), z.undefined()]).optional(), - reset: z.union([billingAttachResetOutboundSchema, z.undefined()]).optional(), - price: z.union([billingAttachPriceOutboundSchema, z.undefined()]).optional(), - proration: z - .union([billingAttachProrationOutboundSchema, z.undefined()]) - .optional(), - rollover: z - .union([billingAttachRolloverOutboundSchema, z.undefined()]) - .optional(), -}); - -export const billingAttachFreeTrialParamsOutboundSchema = z.object({ - duration_length: z.number(), - duration_type: z.string(), - card_required: z.boolean(), -}); - -export const billingAttachCustomizeOutboundSchema = z.object({ - price: z - .union([billingAttachBasePriceOutboundSchema, z.undefined()]) - .optional() - .nullable(), - items: z - .union([z.array(billingAttachPlanItemOutboundSchema), z.undefined()]) - .optional(), - free_trial: z - .union([billingAttachFreeTrialParamsOutboundSchema, z.undefined()]) - .optional() - .nullable(), -}); - -export const billingAttachInvoiceModeOutboundSchema = z.object({ - enabled: z.boolean(), - enable_plan_immediately: z.boolean(), - finalize: z.boolean(), -}); - -export const billingAttachAttachDiscountOutboundSchema = z.object({ - reward_id: z.union([z.string(), z.undefined()]).optional(), - promotion_code: z.union([z.string(), z.undefined()]).optional(), -}); - -export const attachParamsOutboundSchema = z.object({ - customer_id: z.string(), - entity_id: z.union([z.string(), z.undefined()]).optional(), - plan_id: z.string(), - feature_quantities: z - .union([z.array(billingAttachFeatureQuantityOutboundSchema), z.undefined()]) - .optional(), - version: z.union([z.number(), z.undefined()]).optional(), - customize: z - .union([billingAttachCustomizeOutboundSchema, z.undefined()]) - .optional(), - invoice_mode: z - .union([billingAttachInvoiceModeOutboundSchema, z.undefined()]) - .optional(), - proration_behavior: z.union([z.string(), z.undefined()]).optional(), - discounts: z - .union([z.array(billingAttachAttachDiscountOutboundSchema), z.undefined()]) - .optional(), - success_url: z.union([z.string(), z.undefined()]).optional(), - new_billing_subscription: z.union([z.boolean(), z.undefined()]).optional(), - plan_schedule: z.union([z.string(), z.undefined()]).optional(), -}); - -const closedEnumSchema = z.any(); - -const openEnumSchema = z.any(); - -export const billingAttachPriceIntervalSchema = closedEnumSchema; - -export const billingAttachBasePriceSchema = z.object({ - amount: z.number(), - interval: billingAttachPriceIntervalSchema, - intervalCount: z.union([z.number(), z.undefined()]).optional(), -}); - -export const billingAttachResetIntervalSchema = closedEnumSchema; - -export const billingAttachResetSchema = z.object({ - interval: billingAttachResetIntervalSchema, - intervalCount: z.union([z.number(), z.undefined()]).optional(), -}); - -export const billingAttachItemPriceIntervalSchema = closedEnumSchema; - -export const billingAttachBillingMethodSchema = closedEnumSchema; - -export const billingAttachPriceSchema = z.object({ - amount: z.union([z.number(), z.undefined()]).optional(), - tiers: z.union([z.array(billingAttachTierSchema), z.undefined()]).optional(), - interval: billingAttachItemPriceIntervalSchema, - intervalCount: z.union([z.number(), z.undefined()]).optional(), - billingUnits: z.union([z.number(), z.undefined()]).optional(), - billingMethod: billingAttachBillingMethodSchema, - maxPurchase: z.union([z.number(), z.undefined()]).optional(), -}); - -export const billingAttachOnIncreaseSchema = closedEnumSchema; - -export const billingAttachOnDecreaseSchema = closedEnumSchema; - -export const billingAttachProrationSchema = z.object({ - onIncrease: billingAttachOnIncreaseSchema, - onDecrease: billingAttachOnDecreaseSchema, -}); - -export const billingAttachExpiryDurationTypeSchema = closedEnumSchema; - -export const billingAttachRolloverSchema = z.object({ - max: z.union([z.number(), z.undefined()]).optional(), - expiryDurationType: billingAttachExpiryDurationTypeSchema, - expiryDurationLength: z.union([z.number(), z.undefined()]).optional(), -}); - -export const billingAttachPlanItemSchema = z.object({ - featureId: z.string(), - included: z.union([z.number(), z.undefined()]).optional(), - unlimited: z.union([z.boolean(), z.undefined()]).optional(), - reset: z.union([billingAttachResetSchema, z.undefined()]).optional(), - price: z.union([billingAttachPriceSchema, z.undefined()]).optional(), - proration: z.union([billingAttachProrationSchema, z.undefined()]).optional(), - rollover: z.union([billingAttachRolloverSchema, z.undefined()]).optional(), -}); - -export const billingAttachDurationTypeSchema = closedEnumSchema; - -export const billingAttachFreeTrialParamsSchema = z.object({ - durationLength: z.number(), - durationType: z - .union([billingAttachDurationTypeSchema, z.undefined()]) - .optional(), - cardRequired: z.union([z.boolean(), z.undefined()]).optional(), -}); - -export const billingAttachCustomizeSchema = z.object({ - price: z - .union([billingAttachBasePriceSchema, z.undefined()]) - .optional() - .nullable(), - items: z - .union([z.array(billingAttachPlanItemSchema), z.undefined()]) - .optional(), - freeTrial: z - .union([billingAttachFreeTrialParamsSchema, z.undefined()]) - .optional() - .nullable(), -}); - -export const billingAttachProrationBehaviorSchema = closedEnumSchema; - -export const billingAttachPlanScheduleSchema = closedEnumSchema; - -export const attachParamsSchema = z.object({ - customerId: z.string(), - entityId: z.union([z.string(), z.undefined()]).optional(), - planId: z.string(), - featureQuantities: z - .union([z.array(billingAttachFeatureQuantitySchema), z.undefined()]) - .optional(), - version: z.union([z.number(), z.undefined()]).optional(), - customize: z.union([billingAttachCustomizeSchema, z.undefined()]).optional(), - invoiceMode: z - .union([billingAttachInvoiceModeSchema, z.undefined()]) - .optional(), - prorationBehavior: z - .union([billingAttachProrationBehaviorSchema, z.undefined()]) - .optional(), - discounts: z - .union([z.array(billingAttachAttachDiscountSchema), z.undefined()]) - .optional(), - successUrl: z.union([z.string(), z.undefined()]).optional(), - newBillingSubscription: z.union([z.boolean(), z.undefined()]).optional(), - planSchedule: z - .union([billingAttachPlanScheduleSchema, z.undefined()]) - .optional(), -}); - -export const billingAttachCodeSchema = openEnumSchema; - -export const billingAttachRequiredActionSchema = z.object({ - code: billingAttachCodeSchema, - reason: z.string(), -}); - -export const billingAttachResponseSchema = z.object({ - customerId: z.string(), - entityId: z.union([z.string(), z.undefined()]).optional(), - invoice: z.union([billingAttachInvoiceSchema, z.undefined()]).optional(), - paymentUrl: z.string().nullable(), - requiredAction: z - .union([billingAttachRequiredActionSchema, z.undefined()]) - .optional(), -}); diff --git a/packages/autumn-js/src/generated/index.ts b/packages/autumn-js/src/generated/index.ts index 8e42b7b2b..2f167341c 100644 --- a/packages/autumn-js/src/generated/index.ts +++ b/packages/autumn-js/src/generated/index.ts @@ -2,7 +2,7 @@ // Run `bun api` to regenerate export * from "./aggregateEventsSchemas"; -export * from "./billingAttachSchemas"; +export * from "./attachSchemas"; export * from "./createReferralCodeSchemas"; export * from "./getOrCreateCustomerSchemas"; export * from "./listEventsSchemas"; diff --git a/packages/autumn-js/src/generated/listPlansSchemas.ts b/packages/autumn-js/src/generated/listPlansSchemas.ts index f38aeaf52..e94db92f1 100644 --- a/packages/autumn-js/src/generated/listPlansSchemas.ts +++ b/packages/autumn-js/src/generated/listPlansSchemas.ts @@ -31,6 +31,7 @@ export const listPlansToSchema = z.union([z.number(), z.string()]); export const listPlansTierSchema = z.object({ to: z.union([z.number(), z.string()]), amount: z.number(), + flatAmount: z.union([z.number(), z.undefined()]).optional().nullable(), }); export const listPlansItemDisplaySchema = z.object({ @@ -79,6 +80,8 @@ export const listPlansResetSchema = z.object({ intervalCount: z.union([z.number(), z.undefined()]).optional(), }); +export const listPlansTierBehaviorSchema = openEnumSchema; + export const listPlansPriceItemIntervalSchema = openEnumSchema; export const listPlansBillingMethodSchema = openEnumSchema; @@ -86,6 +89,9 @@ 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(), + tierBehavior: z + .union([listPlansTierBehaviorSchema, z.undefined()]) + .optional(), interval: listPlansPriceItemIntervalSchema, intervalCount: z.union([z.number(), z.undefined()]).optional(), billingUnits: z.number(), @@ -122,6 +128,13 @@ export const listPlansFreeTrialSchema = z.object({ export const listPlansEnvSchema = openEnumSchema; +export const listPlansScenarioSchema = openEnumSchema; + +export const listPlansCustomerEligibilitySchema = z.object({ + trialAvailable: z.union([z.boolean(), z.undefined()]).optional(), + scenario: listPlansScenarioSchema, +}); + export const listPlansListSchema = z.object({ id: z.string(), name: z.string(), @@ -137,6 +150,9 @@ export const listPlansListSchema = z.object({ env: listPlansEnvSchema, archived: z.boolean(), baseVariantId: z.string().nullable(), + customerEligibility: z + .union([listPlansCustomerEligibilitySchema, z.undefined()]) + .optional(), }); export const listPlansResponseSchema = z.object({ diff --git a/packages/autumn-js/src/react/client/AutumnClient.ts b/packages/autumn-js/src/react/client/AutumnClient.ts index aa2e8484a..e87d782c9 100644 --- a/packages/autumn-js/src/react/client/AutumnClient.ts +++ b/packages/autumn-js/src/react/client/AutumnClient.ts @@ -1,15 +1,18 @@ import type { AggregateEventsResponse, - BillingAttachResponse, + AttachResponse, BillingUpdateResponse, CreateReferralCodeResponse, Customer, ListEventsResponse, ListPlansResponse, + MultiAttachResponse, OpenCustomerPortalResponse, PreviewAttachResponse, + PreviewMultiAttachResponse, PreviewUpdateResponse, RedeemReferralCodeResponse, + SetupPaymentResponse, } from "@useautumn/sdk"; import type { IAutumnClient } from "./IAutumnClient"; import { createHttpClient } from "./internal/httpClient"; @@ -37,7 +40,7 @@ export const createAutumnClient = ( body: params, }), attach: (params) => - http.request({ + http.request({ route: "attach", body: params, }), @@ -56,6 +59,21 @@ export const createAutumnClient = ( route: "previewUpdateSubscription", body: params, }), + multiAttach: (params) => + http.request({ + route: "multiAttach", + body: params, + }), + previewMultiAttach: (params) => + http.request({ + route: "previewMultiAttach", + body: params, + }), + setupPayment: (params) => + http.request({ + route: "setupPayment", + body: params, + }), openCustomerPortal: (params) => http.request({ route: "openCustomerPortal", diff --git a/packages/autumn-js/src/react/client/IAutumnClient.ts b/packages/autumn-js/src/react/client/IAutumnClient.ts index 41c270bfa..ba1adf4ec 100644 --- a/packages/autumn-js/src/react/client/IAutumnClient.ts +++ b/packages/autumn-js/src/react/client/IAutumnClient.ts @@ -1,6 +1,7 @@ import type { AggregateEventsResponse, - BillingAttachResponse, + AttachResponse, + MultiAttachResponse, BillingUpdateResponse, CreateReferralCodeResponse, Customer, @@ -8,8 +9,10 @@ import type { ListPlansResponse, OpenCustomerPortalResponse, PreviewAttachResponse, + PreviewMultiAttachResponse, PreviewUpdateResponse, RedeemReferralCodeResponse, + SetupPaymentResponse, } from "@useautumn/sdk"; import type { AggregateEventsParams, @@ -17,10 +20,13 @@ import type { CreateReferralCodeParams, GetOrCreateCustomerClientParams, ListEventsParams, + MultiAttachParams, OpenCustomerPortalParams, PreviewAttachParams, + PreviewMultiAttachParams, PreviewUpdateSubscriptionParams, RedeemReferralCodeParams, + SetupPaymentParams, UpdateSubscriptionParams, } from "../../types"; @@ -29,7 +35,7 @@ export interface IAutumnClient { getOrCreateCustomer: ( params?: GetOrCreateCustomerClientParams, ) => Promise; - attach: (params: AttachParams) => Promise; + attach: (params: AttachParams) => Promise; previewAttach: ( params: PreviewAttachParams, ) => Promise; @@ -39,6 +45,13 @@ export interface IAutumnClient { previewUpdateSubscription: ( params: PreviewUpdateSubscriptionParams, ) => Promise; + multiAttach: ( + params: MultiAttachParams, + ) => Promise; + previewMultiAttach: ( + params: PreviewMultiAttachParams, + ) => Promise; + setupPayment: (params: SetupPaymentParams) => Promise; openCustomerPortal: ( params: OpenCustomerPortalParams, ) => Promise; diff --git a/packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts b/packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts index 73241eb34..a03af0001 100644 --- a/packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts +++ b/packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts @@ -1,21 +1,27 @@ "use client"; import type { - BillingAttachResponse, + AttachResponse, BillingUpdateResponse, CheckResponse, Customer, + MultiAttachResponse, OpenCustomerPortalResponse, PreviewAttachResponse, + PreviewMultiAttachResponse, PreviewUpdateResponse, + SetupPaymentResponse, } from "@useautumn/sdk"; import { useCallback } from "react"; import type { AttachParams, CheckParams, + MultiAttachParams, OpenCustomerPortalParams, PreviewAttachParams, + PreviewMultiAttachParams, PreviewUpdateSubscriptionParams, + SetupPaymentParams, UpdateSubscriptionParams, } from "../../../types"; import type { IAutumnClient } from "../../client/IAutumnClient"; @@ -35,11 +41,6 @@ const redirectToUrl = ({ } }; -type SetupPaymentParams = { - successUrl?: string; - openInNewTab?: boolean; -}; - export const useCustomerActions = ({ client, customer, @@ -48,7 +49,7 @@ export const useCustomerActions = ({ customer: Customer | null; }) => { const attach = useCallback( - async (params: AttachParams): Promise => { + async (params: AttachParams): Promise => { const response = await client.attach({ ...params, successUrl: params.successUrl ?? window.location.href, @@ -127,20 +128,41 @@ 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({ + const multiAttach = useCallback( + async (params: MultiAttachParams): Promise => { + const response = await client.multiAttach({ + ...params, successUrl: params.successUrl ?? window.location.href, }); - const redirectUrl = response.url ?? response.paymentUrl; + if (response.paymentUrl) { + redirectToUrl({ + url: response.paymentUrl, + openInNewTab: params.openInNewTab, + }); + } + return response; + }, + [client], + ); + + const previewMultiAttach = useCallback( + async ( + params: PreviewMultiAttachParams, + ): Promise => { + return client.previewMultiAttach(params); + }, + [client], + ); + + const setupPayment = useCallback( + async (params: SetupPaymentParams = {}): Promise => { + const response = await client.setupPayment({ + ...params, + successUrl: params.successUrl ?? window.location.href, + }); + + const redirectUrl = response.url; if (redirectUrl) { redirectToUrl({ url: redirectUrl, @@ -158,6 +180,8 @@ export const useCustomerActions = ({ previewAttach, updateSubscription, previewUpdateSubscription, + multiAttach, + previewMultiAttach, check, openCustomerPortal, setupPayment, @@ -167,8 +191,10 @@ export const useCustomerActions = ({ export type { AttachParams, CheckParams, + MultiAttachParams, OpenCustomerPortalParams, PreviewAttachParams, + PreviewMultiAttachParams, PreviewUpdateSubscriptionParams, SetupPaymentParams, UpdateSubscriptionParams, diff --git a/packages/autumn-js/src/react/hooks/useCustomer.ts b/packages/autumn-js/src/react/hooks/useCustomer.ts index 74c6d3c58..4c4c3b914 100644 --- a/packages/autumn-js/src/react/hooks/useCustomer.ts +++ b/packages/autumn-js/src/react/hooks/useCustomer.ts @@ -2,21 +2,27 @@ import { useQuery } from "@tanstack/react-query"; import type { - BillingAttachResponse, + AttachResponse, BillingUpdateResponse, CheckResponse, Customer, + MultiAttachResponse, OpenCustomerPortalResponse, PreviewAttachResponse, + PreviewMultiAttachResponse, PreviewUpdateResponse, + SetupPaymentResponse, } from "@useautumn/sdk"; import type { AttachParams, CheckParams, GetOrCreateCustomerClientParams, + MultiAttachParams, OpenCustomerPortalParams, PreviewAttachParams, + PreviewMultiAttachParams, PreviewUpdateSubscriptionParams, + SetupPaymentParams, UpdateSubscriptionParams, } from "../../types"; import { useAutumnClient } from "../AutumnContext"; @@ -43,7 +49,7 @@ export type UseCustomerResult = HookResultWithMethods< * @param params - Plan ID and optional configuration (free trial, custom pricing, discounts). * @returns Billing response with customer ID, invoice details, and payment URL if checkout required. */ - attach: (params: AttachParams) => Promise; + attach: (params: AttachParams) => Promise; /** * Previews the billing changes that would occur when attaching a plan, without making any changes. @@ -82,6 +88,33 @@ export type UseCustomerResult = HookResultWithMethods< */ check: (params: UseCustomerCheckParams) => CheckResponse; + /** + * Attaches multiple plans to the customer in one operation. + * Automatically redirects to checkout if payment is required. + * @param params - List of plans with optional feature quantities, free trial, and discounts. + * @returns Billing response with customer ID, invoice details, and payment URL if checkout required. + */ + multiAttach: (params: MultiAttachParams) => Promise; + + /** + * Previews the billing changes for attaching multiple plans, without making changes. + * @param params - List of plans with optional feature quantities to preview. + * @returns Preview with line items, totals, and effective dates for the proposed changes. + */ + previewMultiAttach: ( + params: PreviewMultiAttachParams, + ) => Promise; + + /** + * Creates a payment setup session for the customer to add or update their payment method. + * Automatically redirects to the Stripe setup page. + * @param params - Optional success URL and plan to attach after setup. + * @returns Setup response with URL to redirect the customer. + */ + setupPayment: ( + params?: SetupPaymentParams, + ) => Promise; + /** * Opens the Stripe customer billing portal for this customer. * @param params - Optional return URL and configuration. @@ -96,7 +129,7 @@ export type UseCustomerResult = HookResultWithMethods< /** * Fetches or creates an Autumn customer and provides billing actions. * - * @returns Customer data along with billing methods: `attach`, `previewAttach`, `updateSubscription`, `previewUpdateSubscription`, `check`, and `openCustomerPortal`. + * @returns Customer data along with billing methods: `attach`, `previewAttach`, `updateSubscription`, `previewUpdateSubscription`, `multiAttach`, `previewMultiAttach`, `check`, `setupPayment`, and `openCustomerPortal`. */ export const useCustomer = ( params: UseCustomerParams = {}, diff --git a/packages/autumn-js/src/react/index.ts b/packages/autumn-js/src/react/index.ts index e87a12f3d..5d2b7f812 100644 --- a/packages/autumn-js/src/react/index.ts +++ b/packages/autumn-js/src/react/index.ts @@ -7,10 +7,13 @@ export type { ClientCreateReferralCodeParams, ClientGetOrCreateCustomerParams, ClientListEventsParams, + ClientMultiAttachParams, ClientOpenCustomerPortalParams, ClientPreviewAttachParams, + ClientPreviewMultiAttachParams, ClientPreviewUpdateSubscriptionParams, ClientRedeemReferralCodeParams, + ClientSetupPaymentParams, ClientUpdateSubscriptionParams, ProtectedFields, } from "../types/params"; diff --git a/packages/autumn-js/src/types/index.ts b/packages/autumn-js/src/types/index.ts index dbf3fff27..053638008 100644 --- a/packages/autumn-js/src/types/index.ts +++ b/packages/autumn-js/src/types/index.ts @@ -5,10 +5,13 @@ export type { ClientCreateReferralCodeParams as CreateReferralCodeParams, ClientGetOrCreateCustomerParams as GetOrCreateCustomerClientParams, ClientListEventsParams as ListEventsParams, + ClientMultiAttachParams as MultiAttachParams, ClientOpenCustomerPortalParams as OpenCustomerPortalParams, ClientPreviewAttachParams as PreviewAttachParams, + ClientPreviewMultiAttachParams as PreviewMultiAttachParams, ClientPreviewUpdateSubscriptionParams as PreviewUpdateSubscriptionParams, ClientRedeemReferralCodeParams as RedeemReferralCodeParams, + ClientSetupPaymentParams as SetupPaymentParams, ClientUpdateSubscriptionParams as UpdateSubscriptionParams, ProtectedFields, } from "./params"; diff --git a/packages/autumn-js/src/types/params.ts b/packages/autumn-js/src/types/params.ts index 98d9e0c40..907b4e762 100644 --- a/packages/autumn-js/src/types/params.ts +++ b/packages/autumn-js/src/types/params.ts @@ -5,13 +5,19 @@ import type { CustomerExpand, EventsAggregateParams, EventsListParams, + MultiAttachParams, OpenCustomerPortalParams, PreviewAttachParams, + PreviewMultiAttachParams, PreviewUpdateParams, RedeemReferralCodeParams, + SetupPaymentParams, UpdateSubscriptionParams, } from "@useautumn/sdk"; +/** Flattens Omit/Pick/intersection types so hover shows all fields */ +type Prettify = { [K in keyof T]: T[K] } & {}; + /** Fields injected by backend - stripped from frontend params */ export type ProtectedFields = "customerId" | "customerData"; @@ -22,15 +28,17 @@ export type ClientGetOrCreateCustomerParams = { }; /** Check params for local balance check */ -export type ClientCheckParams = Omit; +export type ClientCheckParams = Prettify>; /** Attach params without protected fields (for frontend use) */ -export type ClientAttachParams = Omit< - AttachParams, - ProtectedFields | "sendEvent" | "properties" | "withPreview" -> & { - openInNewTab?: boolean; -}; +export type ClientAttachParams = Prettify< + Omit< + AttachParams, + ProtectedFields | "sendEvent" | "properties" | "withPreview" + > & { + openInNewTab?: boolean; + } +>; /** Open customer portal params without protected fields (for frontend use) */ export type ClientOpenCustomerPortalParams = Omit< @@ -80,3 +88,25 @@ export type ClientPreviewUpdateSubscriptionParams = Omit< PreviewUpdateParams, ProtectedFields >; + +/** Multi-attach params without protected fields (for frontend use) */ +export type ClientMultiAttachParams = Omit< + MultiAttachParams, + ProtectedFields +> & { + openInNewTab?: boolean; +}; + +/** Preview multi-attach params without protected fields (for frontend use) */ +export type ClientPreviewMultiAttachParams = Omit< + PreviewMultiAttachParams, + ProtectedFields +>; + +/** Setup payment params without protected fields (for frontend use) */ +export type ClientSetupPaymentParams = Omit< + SetupPaymentParams, + ProtectedFields +> & { + openInNewTab?: boolean; +}; diff --git a/packages/openapi/openapi-stripped.yml b/packages/openapi/openapi-stripped.yml index 8c58ffed6..d696988bf 100644 --- a/packages/openapi/openapi-stripped.yml +++ b/packages/openapi/openapi-stripped.yml @@ -672,11 +672,15 @@ components: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or 'amount' is + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' is required. tier_behavior: enum: @@ -802,6 +806,27 @@ components: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -1000,6 +1025,10 @@ components: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount @@ -2006,11 +2035,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -2357,12 +2389,16 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or - 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' + is required. tier_behavior: enum: - graduated @@ -2489,6 +2525,27 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -2786,12 +2843,16 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or - 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' + is required. tier_behavior: enum: - graduated @@ -2918,6 +2979,27 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -3221,11 +3303,15 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' is required. tier_behavior: enum: @@ -3355,6 +3441,27 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -3549,11 +3656,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -3886,12 +3996,16 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or - 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' + is required. tier_behavior: enum: - graduated @@ -4018,6 +4132,27 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -4778,7 +4913,7 @@ paths: - *a5 /v1/billing.attach: post: - operationId: billingAttach + operationId: attach description: >- Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. @@ -4916,11 +5051,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -5191,7 +5329,7 @@ paths: - *a5 /v1/billing.multi_attach: post: - operationId: billingMultiAttach + operationId: multiAttach description: >- Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated. @@ -5310,11 +5448,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -5767,11 +5908,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -6167,11 +6311,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -6625,11 +6772,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -7017,11 +7167,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -7464,11 +7617,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -8039,6 +8195,12 @@ paths: amount: type: number description: The price of the product item for this tier. + flat_amount: + anyOf: + - type: number + - type: "null" + description: A flat fee charged for this tier, in addition to the per-unit + amount. required: - to - amount diff --git a/packages/openapi/openapi.yml b/packages/openapi/openapi.yml index be00bc43d..9ad748612 100644 --- a/packages/openapi/openapi.yml +++ b/packages/openapi/openapi.yml @@ -671,11 +671,15 @@ components: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or 'amount' is + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' is required. tier_behavior: enum: @@ -801,6 +805,27 @@ components: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -999,6 +1024,10 @@ components: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount @@ -2100,11 +2129,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -2449,12 +2481,16 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or - 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' + is required. tier_behavior: enum: - graduated @@ -2581,6 +2617,27 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -2906,12 +2963,16 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or - 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' + is required. tier_behavior: enum: - graduated @@ -3038,6 +3099,27 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -3342,11 +3424,15 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' is required. tier_behavior: enum: @@ -3476,6 +3562,27 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -3706,11 +3813,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -4041,12 +4151,16 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include - the included amount. Either 'tiers' or - 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the + included amount. Either 'tiers' or 'amount' + is required. tier_behavior: enum: - graduated @@ -4173,6 +4287,27 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, + upgrade, downgrade). + required: + - scenario required: - id - name @@ -5083,7 +5218,7 @@ paths: - *a1 /v1/billing.attach: post: - operationId: billingAttach + operationId: attach description: >- Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. @@ -5306,11 +5441,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -5577,7 +5715,7 @@ paths: - *a1 /v1/billing.multi_attach: post: - operationId: billingMultiAttach + operationId: multiAttach description: |- Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated. @@ -5723,11 +5861,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -6235,11 +6376,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -6647,11 +6791,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -7170,11 +7317,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -7603,11 +7753,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -8042,11 +8195,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. - Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -8662,6 +8818,12 @@ paths: amount: type: number description: The price of the product item for this tier. + flat_amount: + anyOf: + - type: number + - type: "null" + description: A flat fee charged for this tier, in addition to the per-unit + amount. required: - to - amount diff --git a/packages/openapi/utils/zodSchemaGeneration.ts b/packages/openapi/utils/zodSchemaGeneration.ts index 25565cf74..db4122f19 100644 --- a/packages/openapi/utils/zodSchemaGeneration.ts +++ b/packages/openapi/utils/zodSchemaGeneration.ts @@ -15,7 +15,7 @@ const SCHEMA_SOURCES: SchemaSource[] = [ sdkFile: "get-or-create-customer-op.ts", outputFile: "getOrCreateCustomerSchemas.ts", }, - { sdkFile: "billing-attach-op.ts", outputFile: "billingAttachSchemas.ts" }, + { sdkFile: "attach-op.ts", outputFile: "attachSchemas.ts" }, { sdkFile: "open-customer-portal-op.ts", outputFile: "openCustomerPortalSchemas.ts", diff --git a/packages/openapi/v2.1/contracts/billingContract.ts b/packages/openapi/v2.1/contracts/billingContract.ts index ec1e7ce3a..e235f199f 100644 --- a/packages/openapi/v2.1/contracts/billingContract.ts +++ b/packages/openapi/v2.1/contracts/billingContract.ts @@ -25,7 +25,7 @@ export const billingAttachContract = oc .route({ method: "POST", path: "/v1/billing.attach", - operationId: "billingAttach", + operationId: "attach", tags: ["billing"], description: billingAttachJsDoc, spec: (spec) => ({ @@ -231,7 +231,7 @@ export const billingMultiAttachContract = oc .route({ method: "POST", path: "/v1/billing.multi_attach", - operationId: "billingMultiAttach", + operationId: "multiAttach", tags: ["billing"], description: billingMultiAttachJsDoc, spec: (spec) => ({ @@ -247,7 +247,10 @@ export const billingMultiAttachContract = oc customer_id: "cus_123", plans: [ { plan_id: "pro_plan" }, - { plan_id: "addon_seats", feature_quantities: [{ feature_id: "seats", quantity: 5 }] }, + { + plan_id: "addon_seats", + feature_quantities: [{ feature_id: "seats", quantity: 5 }], + }, ], }, ], @@ -291,7 +294,10 @@ export const billingPreviewMultiAttachContract = oc customer_id: "cus_123", plans: [ { plan_id: "pro_plan" }, - { plan_id: "addon_seats", feature_quantities: [{ feature_id: "seats", quantity: 5 }] }, + { + plan_id: "addon_seats", + feature_quantities: [{ feature_id: "seats", quantity: 5 }], + }, ], }, ], diff --git a/packages/sdk/.speakeasy/code-samples.overlay.yaml b/packages/sdk/.speakeasy/code-samples.overlay.yaml index 0807b4428..d3c41911a 100644 --- a/packages/sdk/.speakeasy/code-samples.overlay.yaml +++ b/packages/sdk/.speakeasy/code-samples.overlay.yaml @@ -123,6 +123,42 @@ actions: console.log(result); } + run(); + - target: $["paths"]["/v1/billing.multi_attach"]["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.multiAttach({ + customerId: "cus_123", + plans: [ + { + planId: "pro_plan", + }, + { + planId: "addon_seats", + featureQuantities: [ + { + featureId: "seats", + quantity: 5, + }, + ], + }, + ], + }); + + console.log(result); + } + run(); - target: $["paths"]["/v1/billing.open_customer_portal"]["post"] update: @@ -169,6 +205,42 @@ actions: console.log(result); } + run(); + - target: $["paths"]["/v1/billing.preview_multi_attach"]["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.previewMultiAttach({ + customerId: "cus_123", + plans: [ + { + planId: "pro_plan", + }, + { + planId: "addon_seats", + featureQuantities: [ + { + featureId: "seats", + quantity: 5, + }, + ], + }, + ], + }); + + console.log(result); + } + run(); - target: $["paths"]["/v1/billing.preview_update"]["post"] update: diff --git a/packages/sdk/.speakeasy/gen.lock b/packages/sdk/.speakeasy/gen.lock index 497558eb1..eba3da3ac 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: 8a5442d98f2532aacfa11b7cd0548123 + docChecksum: 0b183663162bf6d137f4925c91f31e2d docVersion: 2.1.0 speakeasyVersion: 1.719.0 generationVersion: 2.824.1 releaseVersion: 0.10.17 - configChecksum: ba2fd5bf08f38666db0de6e5207ea6e7 + configChecksum: b4221f58c44175fb3ae2ca4ec9e8db6f persistentEdits: - generation_id: 99b4c310-ded2-474d-a5d6-4c41e3b827f1 - pristine_commit_hash: c632eddb94b6676d523ad3b73e4b81ac3e8185b3 - pristine_tree_hash: fdcd71aec4db028c67865d7b7b6860db29db0fca + generation_id: 9ffb7d87-8415-45f4-a401-a5c94cd0777f + pristine_commit_hash: dd59563aaa480bd737cd78a4cfd3ce84f9146d5b + pristine_tree_hash: 740db25e3bbe1c3b458ce17895a14fc28223ff39 features: typescript: additionalDependencies: 0.1.0 @@ -90,10 +90,126 @@ trackedFiles: id: 147b886181ab last_write_checksum: sha1:745ae2d8cabb73e63fed45a1d83682e602daa81b pristine_git_object: 39e2e27b82c7b641f0a498550c99017a00321785 + docs/models/attach-attach-discount.md: + id: c10677064b44 + last_write_checksum: sha1:f0095ac832df6fb4cc055b56d017207985a88adc + pristine_git_object: 92d058f3586e4370fe64fe61ab605c68df98539b + docs/models/attach-base-price.md: + id: f0987a200c0d + last_write_checksum: sha1:81b479b2fac12a6b2c50dc3609c86b98f2fb9de1 + pristine_git_object: 078a48050d424edee38bab00543810a4fc284d1f + docs/models/attach-billing-method.md: + id: a9e5fb6b4776 + last_write_checksum: sha1:937d18347ceb2a0b826b174b96ee62e2da3b9aa5 + pristine_git_object: 128431ae05699466a8d608f28480f8446800a26c + docs/models/attach-code.md: + id: 14b09292cbbc + last_write_checksum: sha1:ee9ad35bc847c0b15c401e25610988b5f03db49b + pristine_git_object: a72bf7b95871aed0e16e742eed4be39b8cbdec8e + docs/models/attach-customize.md: + id: a13da55a0eec + last_write_checksum: sha1:366d4f1a3c43917e80ea6851c12146d324e854ce + pristine_git_object: a60b38def3549d8bdbc8474542185a7a1f7b5f37 + docs/models/attach-duration-type.md: + id: 2b7e68923781 + last_write_checksum: sha1:f447c936a788f2f8a2aa160edff651f58e4e2b54 + pristine_git_object: b8f0cb85dad3714b3919a36f7f0b5eadc4948c87 + docs/models/attach-expiry-duration-type.md: + id: 904c82dee936 + last_write_checksum: sha1:ceca0040a45346a7d1c66c2c0ab6ea1bd5865e58 + pristine_git_object: 4cdbc94d056a195d7fae24cdd02bddd41723fcc3 + docs/models/attach-feature-quantity.md: + id: a387e985e413 + last_write_checksum: sha1:75041fd4dac3584b8a9b542c259fbb2ca01121e2 + pristine_git_object: a3f9f753fa749a2c14773980af5ba997fbf0179a + docs/models/attach-free-trial-params.md: + id: a0f846c089e0 + last_write_checksum: sha1:6b7195949cd885d7d147e8cb2b048b7951b28005 + pristine_git_object: d0ecf9b6c8669bf3050067152ff2805b204553a2 + docs/models/attach-globals.md: + id: 3f5659c4527e + last_write_checksum: sha1:5ecc4152cef4f786f4c1bb41b2b4ca42d51c5bdd + pristine_git_object: 0bccf8fe67e3ec5e109afab60e5e17f4b54cb2c8 + docs/models/attach-invoice-mode.md: + id: 06a085c65c2a + last_write_checksum: sha1:12f4e22bd2f6c3a8afea33451b73c36590e47788 + pristine_git_object: 5cc697e43e44133da8313f8aa11e9eb03e584d3f + docs/models/attach-invoice.md: + id: f8e57e6d6a18 + last_write_checksum: sha1:b8f16fc3db06bd20e23afa7c29c3442c909b4e34 + pristine_git_object: 6df34e90a8ee8df85133eb7f2eba067d0e39351c + docs/models/attach-item-price-interval.md: + id: 3253e6da0499 + last_write_checksum: sha1:86ff31fd64809ac74982a58e8abfab5e0032cc69 + pristine_git_object: fc077e29ba58add4b30b67b9da3a7f1b7ad538af + docs/models/attach-on-decrease.md: + id: 730009f79373 + last_write_checksum: sha1:765e856a18867e8a80669c382c060ac074ec7d0d + pristine_git_object: b520b37c531eb9d21980a0ba797ee8df414f9e2a + docs/models/attach-on-increase.md: + id: 5941c36420ab + last_write_checksum: sha1:bde213c528107f434ce349d5ef81decd39d9f75d + pristine_git_object: 54f331cb0a0bf32bb0cc3e63eb6652a440b2329e docs/models/attach-params.md: id: 83d15924bf0f - last_write_checksum: sha1:e2054df7055d2a1fea8e79b74228182ed1f7b5cf - pristine_git_object: 737879e09355df14daed8497c6f975bc2209907b + last_write_checksum: sha1:4b092574035a4bddaa87e8f10d7feb29d603cfbb + pristine_git_object: abdcf3ff0ae72255325ca56183757ba743bcd8b3 + docs/models/attach-plan-item.md: + id: f8bfccf3f202 + last_write_checksum: sha1:b4e51944ee8cdc61dd528fae6b15b4babc4dcaad + pristine_git_object: 90405d82b336251122d8a0c5f8354d44c9f77222 + docs/models/attach-plan-schedule.md: + id: e1a306c239b7 + last_write_checksum: sha1:386200cce30a5fa82c62b0333cf74be2da7cdf59 + pristine_git_object: 2a33bbc0f774eb80c01a3c872e1c8147767556b3 + docs/models/attach-price-interval.md: + id: a29ee67a79b5 + last_write_checksum: sha1:daa0d0fd68cdafa482a6f1ba5be760749373d0ed + pristine_git_object: 10bb83c8b19c26a1270791127565c14efb904da3 + docs/models/attach-price.md: + id: 47337b9e2859 + last_write_checksum: sha1:b2c6c1b7e8d395687ac3986469436d901c14d72a + pristine_git_object: a0da6e8f71b6fc01b23c71fc36b1c0ab0ef4c10c + docs/models/attach-proration-behavior.md: + id: 1153e52606e3 + last_write_checksum: sha1:27e5bc56e0963ff0ffacfab9d5c2ac36f88497b5 + pristine_git_object: 6072fd88dec37ade280324cee2cbf6f78e6e22d7 + docs/models/attach-proration.md: + id: b8138eefe902 + last_write_checksum: sha1:9538af06d02739c452f9a90a6ee272a4f19b7d50 + pristine_git_object: d9829fe9bd0aec89be1b492d99fdcd6b9fc1f9d7 + docs/models/attach-required-action.md: + id: 0273a38da163 + last_write_checksum: sha1:e3e027765a84fc5793640b9a42d4ed631fc81628 + pristine_git_object: e60561bc1e347e6d5bc22a3f561dfe667ef9736d + docs/models/attach-reset-interval.md: + id: 46d30dbd85c5 + last_write_checksum: sha1:4bb1350161af1333576b3cd9c4a47791e05e4f8e + pristine_git_object: c7df43532fb0fdf24947e5a34f8bcea343c39967 + docs/models/attach-reset.md: + id: 9a8c49f429e2 + last_write_checksum: sha1:78606258ff11a3b6034735856c24ef5743d1bf66 + pristine_git_object: e756b51456c3efce6dcdb795ae4091c9cb61f26d + docs/models/attach-response.md: + id: 7a5806587fd5 + last_write_checksum: sha1:fce4deafc35541beca5b5f5926780b894e7be6f7 + pristine_git_object: e98d964d9a465f06458dc1f3c53520f0c988347f + docs/models/attach-rollover.md: + id: d84522e07be9 + last_write_checksum: sha1:74cc7a9ae199384825cda98df68cff80c65759af + pristine_git_object: 069b311aa7cec45bfc7454dfbfc78dd1c95caf99 + docs/models/attach-tier-behavior.md: + id: b33aedb076c4 + last_write_checksum: sha1:bfaad85a9dbe4ea44f49013985c22e0f377cf54a + pristine_git_object: 11be8f6cdd1f5691b0ed22d7f994483efd093261 + docs/models/attach-tier.md: + id: cee093bde1b6 + last_write_checksum: sha1:561843705c51f86105d836ea5086b7617f30b262 + pristine_git_object: c7767a94e8a5ac93fbe0de9a1eec270351e29804 + docs/models/attach-to.md: + id: 39243c9d9b34 + last_write_checksum: sha1:3bd1426da7224193c44f8ce30151166338187f47 + pristine_git_object: 1a31544c486bbdb05784f5f44d93dd8551f5a8d5 docs/models/balance-billing-method.md: id: 6ade18c9eaff last_write_checksum: sha1:5a53ded38d42283a77c4a67af5e26fad8ccaf59e @@ -116,8 +232,8 @@ trackedFiles: pristine_git_object: 823d2ea29ce9abd3e1be7dba10667b7883e91b14 docs/models/balance-price.md: id: 0befed5ea384 - last_write_checksum: sha1:b5c59877865d0be375c9b6cb20c0414799ae2889 - pristine_git_object: 1139fa432534f678acb82a09428425931d65ad71 + last_write_checksum: sha1:d98eca78ecdf2d6d2b833ef1d3bb34ed4c62a02b + pristine_git_object: 365e312493d3c90629ed2e6d158677b44de27a57 docs/models/balance-reset.md: id: 86f7b6c57601 last_write_checksum: sha1:c693cb32710d2956c47a50e70cfc1ecc0c58ec2c @@ -126,10 +242,14 @@ trackedFiles: id: 65773ade2bd3 last_write_checksum: sha1:4e59e9a9041ff696cde84cf7f7f9d38da161d422 pristine_git_object: fe958e38daba860a25025cc1210cfc4327d8803f + docs/models/balance-tier-behavior.md: + id: 49fad040b38f + last_write_checksum: sha1:e0e8bf8c3965f936b559af3e25997bbbc18e4150 + pristine_git_object: 30c5de4a1922a1de4df750fb121e3f6857391f5c docs/models/balance-tier.md: id: f4fbeac81162 - last_write_checksum: sha1:77b46e618b9c108111e7dcd7652eca1dac054dea - pristine_git_object: cbd35a58ed5fca7faafff777fdd57037cf3ecc49 + last_write_checksum: sha1:b855f1f2e45397ca98adde43f14d2aa3ca675d99 + pristine_git_object: e6265daa10582a4b6815551a71560273e736e4c7 docs/models/balance-to.md: id: 9f9f60556eef last_write_checksum: sha1:c6d5558ffe5fd3a02210edac78ed6144418b7731 @@ -142,118 +262,6 @@ trackedFiles: id: 9de59403580f last_write_checksum: sha1:8d5433ac6435693a81086e91ba42d7ae173e2a45 pristine_git_object: 038a6883854d90582b9758ec49195d01f38d6dc1 - docs/models/billing-attach-attach-discount.md: - id: e49472effcd6 - last_write_checksum: sha1:948dbba08739c741259d1072dbd184b80ef8ae7e - pristine_git_object: afd9045cd61229f1af7bc90ee931f6c6379e412e - docs/models/billing-attach-base-price.md: - id: e661c626b6d1 - last_write_checksum: sha1:8a054d1cc8759a2fa53c720513be293b374cec95 - pristine_git_object: 677de7e4f15f5d6153db2f7a9da88b7c3d479306 - docs/models/billing-attach-billing-method.md: - id: b8065e6e9007 - last_write_checksum: sha1:1ba7d88438747acd7bcb3cef4b014924093d7fed - pristine_git_object: 47e22e39335d95fb36ba6bd8f962dc588bc844fd - docs/models/billing-attach-code.md: - id: 2fe6307f7f0f - last_write_checksum: sha1:72adcc13d2c0f8e0a2c71aa51233ae45adddd295 - pristine_git_object: d4692b8a67cd9100dd6e25e81cd7ba910327a4c9 - docs/models/billing-attach-customize.md: - id: fdbcde378958 - last_write_checksum: sha1:2e447612bb5233cb26960b39fb5e47a4eda6359a - pristine_git_object: 1b1129b4be5bf099bb7cdd55e8439d9d3becaa8d - docs/models/billing-attach-duration-type.md: - id: a223ca393687 - last_write_checksum: sha1:da597a832eb2c6fc75c40c36ad0aed2734b17894 - pristine_git_object: 3256d505f70c38d5f8902255a51791e866252d94 - docs/models/billing-attach-expiry-duration-type.md: - id: c465a9bb3bd3 - last_write_checksum: sha1:0fd891c6002074662d9911894509eccc6c31dd65 - pristine_git_object: e2e0d2c3b393f6bf5a7b8ac22e7a69a648f8afc0 - docs/models/billing-attach-feature-quantity.md: - id: e25424416a8f - last_write_checksum: sha1:e2c6cec98cc74d39d2cf2223b13a83a4ff66e473 - pristine_git_object: 5b4b97bd72e40d81bb178dc4df248b47af2d8d46 - docs/models/billing-attach-free-trial-params.md: - id: 975359df05d2 - last_write_checksum: sha1:2b1b701388b1da29d5accd1d1c05ee4f8cc14296 - pristine_git_object: 397eae097eeaa853b0520ec5008017ee2b557419 - docs/models/billing-attach-globals.md: - id: 64a91dfd79f3 - last_write_checksum: sha1:fe5a8e304ab3c547505a8bf18efaa04b87622e6e - pristine_git_object: e33e3d806a642d9b936d867e0eec217edda9199f - docs/models/billing-attach-invoice-mode.md: - id: 9cd0f26dd730 - last_write_checksum: sha1:4ea16177d21c5944ec180abee1bdb47ccdbc5861 - pristine_git_object: a341890b4e722adbdf3e816a46586d8cf1dbc819 - docs/models/billing-attach-invoice.md: - id: dc71d6a68aab - last_write_checksum: sha1:d2cc788309487a9904ea1fd7f571868979c72949 - pristine_git_object: be6a8d739890cf7edccf5d6c29dd28a93688966e - docs/models/billing-attach-item-price-interval.md: - id: d850bef7cef5 - last_write_checksum: sha1:cbfd1e5b9807a820e12e595cbf30116e4a3acb88 - pristine_git_object: 867bd77fb531de8da3a5c716c743a26fb3589938 - docs/models/billing-attach-on-decrease.md: - id: a0df076b62ab - last_write_checksum: sha1:da8f8b6f204a1b80e40408140f6ff7d577b19b06 - pristine_git_object: df06a306a9c26abe75c78c5f7c030bd4f9d9a0ca - docs/models/billing-attach-on-increase.md: - id: 4a8d71f2d507 - last_write_checksum: sha1:46abd81b456a5523c0baea5229bdb25a0fe89b13 - pristine_git_object: 8d175b5f32d0ab5258d3603569c81faa99487eb2 - docs/models/billing-attach-plan-item.md: - id: 58e822b21366 - last_write_checksum: sha1:c8102b572bd83cf3f426eafc1501c168dbe928d3 - pristine_git_object: cd2eedc4c0ad38d16fa6c51f13b399689f468d07 - 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:89fbad284ec67e221dcac5399e5e9ac3248e6cfe - pristine_git_object: 1a90db121ffd1e2ce0d5e01847600a62199e35d4 - docs/models/billing-attach-price.md: - id: 5f6ce9e5f50b - last_write_checksum: sha1:5c5bf8e11b40571e47418be6e84082721afd9db6 - pristine_git_object: 98f59d3baf4ccbfbb3b5b319379ea80e5c702daf - docs/models/billing-attach-proration-behavior.md: - id: c182a8671ca7 - last_write_checksum: sha1:5843c25ea5915476a6bdaff631f0786943940c1e - pristine_git_object: 19d35f9dd781b09a5013d9a94e96cfdcb3da61af - docs/models/billing-attach-proration.md: - id: cedfbc549872 - 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:d755a3ebe19b2b3410b5e99ca16df1ff4edfa1d7 - pristine_git_object: f6544ea687436f2bc126951af1d62780b06e40fb - docs/models/billing-attach-reset.md: - id: 196d799dde8c - 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:6ffbd787ac740ba3639444a8e1c3fea8c3826cf3 - pristine_git_object: dcc8b723d3677f0766471da6826a7b18ba9f729e - docs/models/billing-attach-tier.md: - id: 93546751245e - last_write_checksum: sha1:a055880ac4c4c48fee2948c096662d6d33797244 - pristine_git_object: f2c2d82662cecd5fd4b9c67b4a337237586344a8 - docs/models/billing-attach-to.md: - id: 11f30839adb7 - last_write_checksum: sha1:ed5f808165422787d1d0637216480818b1ffcd3c - pristine_git_object: 2a7148fde0e0cd4e38a970985affc03a78d27438 docs/models/billing-update-base-price.md: id: 7a3d2f48b101 last_write_checksum: sha1:7028e8e5c838d09806d4146b074c9e4dfba76e2b @@ -324,8 +332,8 @@ trackedFiles: pristine_git_object: 512381bc87ada061d18ea171aae5fe87d700a41b docs/models/billing-update-price.md: id: 656951a74af3 - last_write_checksum: sha1:39a3cf2894b0216e295d257a6c1deb105e6eb693 - pristine_git_object: 58f9407f070ae52da5bf4fecf92f209250e26ef7 + last_write_checksum: sha1:e7dd9cd4a6d8028ca9e1167340b6fd50765afe34 + pristine_git_object: 15b6daf856a255eef540c6a3491d3c2f7a490bf2 docs/models/billing-update-proration-behavior.md: id: f5a10204b697 last_write_checksum: sha1:eb2adbed3dc1bba68b214f5ac4f71bfe41bf97a7 @@ -354,10 +362,14 @@ trackedFiles: id: b8d649352b96 last_write_checksum: sha1:08262275ecabfe3889d8569c05ef060a538067fd pristine_git_object: 495c3c6fa4a4df8c6ec7af9e27ff149d984c2c71 + docs/models/billing-update-tier-behavior.md: + id: 2a2789588c99 + last_write_checksum: sha1:32aa26afaf4d0b9204df361bc708c22a05c2aa53 + pristine_git_object: bea62dbae36eaa667268263c8ad4cb4565437e1e docs/models/billing-update-tier.md: id: 28b5b060baf0 - last_write_checksum: sha1:164379520b922e006296e4ec2fa7a67613f8e636 - pristine_git_object: b150bd56fb9ffbf59c32b6a6aa6aea1a35476c0d + last_write_checksum: sha1:3dfbd52b65a8ea9c8bf9194092c77099effd82e0 + pristine_git_object: a0f37603b8c488c3c11e7c94c05a150203ce93c9 docs/models/billing-update-to.md: id: 450946242eb6 last_write_checksum: sha1:7fe82feb15e2ce97cc617db910628bbc08599e79 @@ -392,8 +404,8 @@ trackedFiles: pristine_git_object: c0f62b4515395a9594e22d8ee35a26953c53bf10 docs/models/check-item.md: id: 65ebecbc13ac - last_write_checksum: sha1:6d80f37382d07217b50d00d238891f79f4dbb153 - pristine_git_object: abd91097aa7cdd9a086362b9e58e929cc2a8c4be + last_write_checksum: sha1:fad79ce2d8c5aea7a2f78c7f8a41b2e838d63131 + pristine_git_object: e63281b6d3a456bfd821ceec602c7d768f9bcf39 docs/models/check-on-decrease.md: id: 361f05432960 last_write_checksum: sha1:218fe1ceed4ce70d3ab91ee5f86430670544df50 @@ -418,6 +430,14 @@ 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-tier-behavior.md: + id: 89be3843344e + last_write_checksum: sha1:5c5067037818a65556151b41c57cce608eac005e + pristine_git_object: 28423762d1e208e3464b8df9e0f10a28813c14f8 docs/models/check-to.md: id: 7df7c9903cc0 last_write_checksum: sha1:5ea0073af130ffb58ba731abe24142cf69496d44 @@ -530,6 +550,10 @@ trackedFiles: id: 213fe4cef877 last_write_checksum: sha1:9a9109b25682ec0ed4db881cf449e6ed823eb124 pristine_git_object: 35385d13f46a0997eb47a1d7c27ae5a26fa60cae + docs/models/create-plan-customer-eligibility.md: + id: bdd55b70ff49 + last_write_checksum: sha1:f6077a98c7f8955fdcac655f5d6cbd4b059c81f0 + pristine_git_object: c4ad38c8fe9198f1cc6bbba4810d52c31978571f docs/models/create-plan-duration-type-request.md: id: db52ff12640b last_write_checksum: sha1:fac917acc26137ab222e20e97f0ce936274fb9f6 @@ -576,12 +600,12 @@ trackedFiles: pristine_git_object: e7e6a8e39482cc4fea622616320d6e60c221971b docs/models/create-plan-item-price-request.md: id: 27895133faf5 - last_write_checksum: sha1:1c81da712ca15c91a9fbf5e099ea472b8c3e058d - pristine_git_object: 9e9af3a94899eac448dbf9776973268ee4c87159 + last_write_checksum: sha1:2a093b909f5f30dc628965b4bc18d8721ad2110f + pristine_git_object: 50c66cdf83f02a26d90326bf62a18232f1616e0f docs/models/create-plan-item-price-response.md: id: 9ef4d0695a07 - last_write_checksum: sha1:16637faf6a0b1c2a23b83207d6f579d15a2be241 - pristine_git_object: c4af69da86cdc8cb1e75fbd62bb047c4a74eb38a + last_write_checksum: sha1:cf7c023bb92835d4e2f1bde9809582c8a2cd5ae6 + pristine_git_object: 107e7733aa22e582e6800310c40f43fbfda5cfef docs/models/create-plan-item.md: id: ecb598dd1edd last_write_checksum: sha1:e4c513d386c49e1a5188b7547bbbc98fd0f10688 @@ -648,8 +672,8 @@ trackedFiles: pristine_git_object: f99bd3cdd5b9038791efdc0811b61abb4b8c7db9 docs/models/create-plan-response.md: id: f48e8b1136af - last_write_checksum: sha1:b2bef811821a5e2b328f1a3a2e9ce85745ef431d - pristine_git_object: ca7ee9f4fd5d93ff067e031960b2b4726900405d + last_write_checksum: sha1:a203f0caab2f9ab1592ac1fe2f94fbf43d11aa87 + pristine_git_object: 72eae3131ae2b03bdbcb7e1123b8b54c6105d74d docs/models/create-plan-rollover-request.md: id: 10237b75cd73 last_write_checksum: sha1:d024a4f706c0ed6332ff255ffc8944b5cce7bc4d @@ -658,14 +682,26 @@ trackedFiles: id: b5e9ec426df2 last_write_checksum: sha1:fc9391a84a8be6a400ac697c9299b87312fd6b6c pristine_git_object: 5333fae7f3fb953439905529c246d31e90c0837b + docs/models/create-plan-scenario.md: + id: cf89a57e8e60 + last_write_checksum: sha1:90c81c609437e2d21da7ab08bf801afa9e13dbea + pristine_git_object: 39bed6932ad1c6c1ffdf35fe623e1f87ef108335 + docs/models/create-plan-tier-behavior-request.md: + id: a8b6b86a026a + last_write_checksum: sha1:9ef8eb045da5b7fd0865603b7482d16f34dbe425 + pristine_git_object: b3a2fb612213fe3ab0669c4c7e197ab83b3b2f36 + docs/models/create-plan-tier-behavior-response.md: + id: efafb363cb61 + last_write_checksum: sha1:8640c7a5a3d2d6d704b55c88e09481ce6da114ea + pristine_git_object: 8d87736b1e186c41aacc8e2f310a2ebf2fe6d817 docs/models/create-plan-tier-request.md: id: b61146fcf793 - last_write_checksum: sha1:79a4113f10fcca61645b17599769078181b05aaa - pristine_git_object: 1910aff519ced4a019e3763d6e8856ba6f817387 + last_write_checksum: sha1:a372627291b29292b4f8e3fcae5d5bdf45df16c5 + pristine_git_object: d5de474816c70f5375a3e321b0717a1095683a6a docs/models/create-plan-tier-response.md: id: abb65350cb3f - last_write_checksum: sha1:4d3357d09152023473bb2e8b5a69852380d27e55 - pristine_git_object: 2f7579b433727fca3192eb30a4d0d86cd12508d6 + last_write_checksum: sha1:fadd3a58d3781b4c25eb212816c72561943e5053 + pristine_git_object: bc1e666a1a16fd285eb3e532ad40808198d271c8 docs/models/create-plan-to-request.md: id: d9a64ab7ab26 last_write_checksum: sha1:53394196e886315b4da09367ca8667c0134c4eb2 @@ -698,6 +734,10 @@ trackedFiles: id: cbfbb0769db5 last_write_checksum: sha1:5cc7fc548fc238c2c4db1517e1192dc036a74139 pristine_git_object: 1e752c7056ae635cb6bd8aa5a72ee4a95db57ed2 + docs/models/customer-eligibility.md: + id: ca41bb82f9bb + last_write_checksum: sha1:e02631dda56de22977a6247934abafd550ccbc14 + pristine_git_object: c8c549fbbd50394bb169032022589240e88d0cba docs/models/customer-env.md: id: f063b206890c last_write_checksum: sha1:cc47133530e606c040759b3f18b48dad7b78cdae @@ -874,6 +914,10 @@ trackedFiles: id: fdfd3a232487 last_write_checksum: sha1:bda036d0335542dc4bea36444ead3b4d1fc31c6b pristine_git_object: d0de73aba38136ebb18f8bdf83d8ebd29c861406 + docs/models/get-plan-customer-eligibility.md: + id: 423468202c81 + last_write_checksum: sha1:c218ddbd0d822e1b1365d9be74b77cc02ab5a706 + pristine_git_object: 962c7a4727ae07a6ae4b127b6ac1d41b8073b5cf docs/models/get-plan-duration-type.md: id: b69c3a89ed38 last_write_checksum: sha1:4d302f73a60464b04f4e308e464d3011868b3a55 @@ -908,8 +952,8 @@ trackedFiles: pristine_git_object: 1e3256b2142d09290462243145af29ca3e0e1590 docs/models/get-plan-item-price.md: id: 861928cd4da1 - last_write_checksum: sha1:785a26e9ea696016718d4c5574c9841bb044d7dc - pristine_git_object: 812fbaf6fe045e8f726af1dfeece30f35ab77c77 + last_write_checksum: sha1:dae51ad53086e7d556ee948fd1b13e4f9a2f226e + pristine_git_object: 83d7ecc7e2318313a31814933b8829a2e1e33cf6 docs/models/get-plan-item.md: id: d1f1aa0f9dc6 last_write_checksum: sha1:2e0a987df242117cc9b9809e4a8b3ba89bb8cce4 @@ -944,16 +988,24 @@ trackedFiles: pristine_git_object: 77c04173688934e1b024f1401da75240777ab5c5 docs/models/get-plan-response.md: id: fd0d6a5893f8 - last_write_checksum: sha1:8e8f4c66cf8c4cc8d6129a0d5719dc6a95d61e79 - pristine_git_object: 570023d52cde6b052ffd014309f4f887c525cb84 + last_write_checksum: sha1:97aae03bfffc36ee5bf342362365923dc0da73e1 + pristine_git_object: ba0e0dfac6d39006ef18de08de9f2f233d6abda9 docs/models/get-plan-rollover.md: id: 8ff9768b18a9 last_write_checksum: sha1:cdf16a0261b49d6cfbe56cf003d94e9e9f819ea0 pristine_git_object: 2ed20d9be6b31bd70b2d30f0b517cd4470cf6273 + docs/models/get-plan-scenario.md: + id: 71d3f38d5b78 + last_write_checksum: sha1:04f38ea11c5f3c5fd1c40172a0e5986798a6c865 + pristine_git_object: 08669b5cc40c450bd9d7bed2620d79bfaa230775 + docs/models/get-plan-tier-behavior.md: + id: f3718ee31687 + last_write_checksum: sha1:1a2f2d68d35dd37f988476bc96bdffa2299d63eb + pristine_git_object: a03d5171735676a42527f85a76a9663d70890c4e docs/models/get-plan-tier.md: id: c466d2316ebd - last_write_checksum: sha1:65962abcb825e75339ea22e000f6b6e7597fa159 - pristine_git_object: 1577a01666d7db242dbc472d2311185c38fb89fa + last_write_checksum: sha1:6510dce214e66606d7114b0f588dc1effbe7df9b + pristine_git_object: 36b8ef1861f4ec1bb38a584e3212e788f842695d docs/models/get-plan-to.md: id: 90434fb9c1da last_write_checksum: sha1:a6bc90910fbd84449aee946bfe08835049643304 @@ -1074,6 +1126,10 @@ trackedFiles: id: 3f2d4bd971cc last_write_checksum: sha1:11870331e68516a49daa39eab1dc751ee0a8674b pristine_git_object: 2e6e429f693aa84aaeda77421040f827cdd1949f + docs/models/list-plans-customer-eligibility.md: + id: c175b1994296 + last_write_checksum: sha1:26191dbd7d358b1cfdaa594dc0ba116fcead3ce3 + pristine_git_object: 46876a2a06142f9d0cb3d14638d12da86c6126a4 docs/models/list-plans-duration-type.md: id: bc63d2df769a last_write_checksum: sha1:776412644be4783cd7fa9929c44f47cea49d2c03 @@ -1108,16 +1164,16 @@ trackedFiles: pristine_git_object: 534ae703c77698677e330b81365b9db16e57ed9e docs/models/list-plans-item-price.md: id: 2adf6736dcce - last_write_checksum: sha1:293360fa3507b5cd5cabb2b3f68e8332fb516c00 - pristine_git_object: 1bd6eaf00158f156ae1804a3c7ad5003913b00aa + last_write_checksum: sha1:a4c66984e7764ff8351d8033a6bd9da094800c78 + pristine_git_object: a45a17984c6c2810c8355f8f4718f2f277aa7bfe 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 + last_write_checksum: sha1:44b80ecdbc23afc3712a4c66b009c235aaeda807 + pristine_git_object: 94c1c5e7f7a3b7bca023c517724c9188f5787bfd docs/models/list-plans-params.md: id: 4b66bf1417a6 last_write_checksum: sha1:ace49e58845a78383d5e26214e791bf7a131fd5b @@ -1154,10 +1210,18 @@ trackedFiles: id: 19aa526beff0 last_write_checksum: sha1:c80cdda87eeed13f3ed024a4629a1ae752955f12 pristine_git_object: 760b01c5522a773685658074ba52e25bfbad02f9 + docs/models/list-plans-scenario.md: + id: 0e38b94f3a6c + last_write_checksum: sha1:d3c0d78500b2f7c5d191a3538c4176d509271c7c + pristine_git_object: 0247f64d20dddfd24ac0d09a5b4def36f2ad381d + docs/models/list-plans-tier-behavior.md: + id: 3e6b30e1aad3 + last_write_checksum: sha1:d429823d060ba77f2ea07699a45bb00883b73c15 + pristine_git_object: 077a40dfdaac9037f7ecf4ed5a659165a709b8b8 docs/models/list-plans-tier.md: id: ee46ee372f11 - last_write_checksum: sha1:2fc0d038dd234a0b4200a7afa8992461f633c6f9 - pristine_git_object: 04a868be6df7cfd2461a87f928c606144e623a62 + last_write_checksum: sha1:fe8c8d433aba87615a7d0c16f8c35bcdff65d63b + pristine_git_object: de7b22e22b1dd9f1145714010a7fd77d7114ffcb docs/models/list-plans-to.md: id: 219811266af2 last_write_checksum: sha1:ae21918d904d84961771ab388c897c8c92b38d61 @@ -1166,6 +1230,130 @@ trackedFiles: id: 902fdb41bbb2 last_write_checksum: sha1:8a14d90ad1601b2d21551520d37af9a93fe51db1 pristine_git_object: 4ea81aa954edc194f40ee68038b0d4f578c04ef8 + docs/models/multi-attach-attach-discount.md: + id: 3536a21c4f47 + last_write_checksum: sha1:2dfea27b10b93fd68105a4ca58a94f4d4bcf1c1b + pristine_git_object: 6cff81127dfa0da6f95f4f1d3156eca0cdf92715 + docs/models/multi-attach-base-price.md: + id: 1ceb0d6ba405 + last_write_checksum: sha1:7450655e3a11c55d929a5fc33d680e066d457170 + pristine_git_object: 199a981d4f69a2401e27f70c412501d66e314cde + docs/models/multi-attach-billing-method.md: + id: 0a1702e9b84b + last_write_checksum: sha1:9d863ab54bef7b8b74274b98275c70565f5473cd + pristine_git_object: 9f2a0075d180395846c3983ea3d08951a26c1b1f + docs/models/multi-attach-code.md: + id: 09921b9ac8e1 + last_write_checksum: sha1:ae1135e9ef6470f2e322b2ecf00fcabec0462413 + pristine_git_object: f02c727931ffa9829ba35f4258b5d236c78ebd4c + docs/models/multi-attach-customize.md: + id: aedf94cc14eb + last_write_checksum: sha1:e691f0270d87b69a45e6e7422bbf55802f798479 + pristine_git_object: d6b8c7704f9b6cf7013f05d160de4822762032da + docs/models/multi-attach-duration-type.md: + id: 83ab07248c10 + last_write_checksum: sha1:4e5761053a27d492899e3027ab1325d73d0d282b + pristine_git_object: bde486e99a5dc17a15a6fc951c03eddd9c107e4e + docs/models/multi-attach-entity-data.md: + id: f472fe8a9435 + last_write_checksum: sha1:a0e9d5e51bda786b96eb45372b2ba9520605c9be + pristine_git_object: ebaa179e476342a825d22cbce9714ed58ccd1c02 + docs/models/multi-attach-expiry-duration-type.md: + id: 2ecaef55edbc + last_write_checksum: sha1:42d19c4558595a2c89bcf39a1a2cc44460504fab + pristine_git_object: 38e0a16ed37ff5ea3502d7d297d64160a43667ee + docs/models/multi-attach-feature-quantity.md: + id: 9da6ff16e2fd + last_write_checksum: sha1:95503ce1761b928dc8f0e9cad9a70f1cddcaf3c4 + pristine_git_object: 9943d05a86864be4863be3cd7f59884831aa42d9 + docs/models/multi-attach-free-trial-params.md: + id: 09c9804b2958 + last_write_checksum: sha1:0590ab5d90b630f4ac283d76405d785e0c2b61ab + pristine_git_object: 8c9f50dea002a06f8f80b82a30660e306a226fe8 + docs/models/multi-attach-globals.md: + id: 23788c449521 + last_write_checksum: sha1:a929bfb9d470e63073b0f01edc32df7366803967 + pristine_git_object: 6f7b2e7685e02280d4ed4fb1e988b6101060d637 + docs/models/multi-attach-invoice-mode.md: + id: fbc780e49711 + last_write_checksum: sha1:4145730fd2c9b2f56de7b17d12bf0aee37eb21cf + pristine_git_object: a87ed88f13c58a4569d8e7b259b0fb458ffa9563 + docs/models/multi-attach-invoice.md: + id: 2d7bd760c6e9 + last_write_checksum: sha1:47226d6562b0fcdc5f8ec2dfd260e880d4e969e1 + pristine_git_object: 7943403c6dfe1559cdd2224cfa92c4a6efe9f462 + docs/models/multi-attach-item-price-interval.md: + id: db3f505e1ab0 + last_write_checksum: sha1:b579550dfcb034e431508065a418f8d0cf4c1193 + pristine_git_object: 09c43da51b2b2e7c91f1b4e9b2d1618a2b536501 + docs/models/multi-attach-on-decrease.md: + id: 2e5c312c27bc + last_write_checksum: sha1:6601219d84d1cbdb5c55fc8ca2fa42f26497d14a + pristine_git_object: b12c1326f95cc413cb43bc1c1ba6f99019f237c1 + docs/models/multi-attach-on-increase.md: + id: 205e026d8cf8 + last_write_checksum: sha1:3964c19181a3c65a195fb56a076b88543e797a9a + pristine_git_object: bd732949a267572cf5e813c15201d9e29fb3fcd9 + docs/models/multi-attach-params.md: + id: 113b76176b22 + last_write_checksum: sha1:a629146e209111ddafce56d65e9ade442576a913 + pristine_git_object: 01e1e3cde1e2a9ebc908e2a4f5d04fb04e09b58c + docs/models/multi-attach-plan-item.md: + id: 72f3f506549b + last_write_checksum: sha1:2cfe344801acdd1414a1be6e44218a19c9683143 + pristine_git_object: 21e4e5f9ed425f26e8bb036f20bf2288f3ac71e9 + docs/models/multi-attach-plan.md: + id: 6bfd56707e86 + last_write_checksum: sha1:8da4e83d072e4aedc163cecb64d9ec8f8679d111 + pristine_git_object: 289d16499c2cb1841281d31151f57d3e82d7fa93 + docs/models/multi-attach-price-interval.md: + id: c6f7ad1d8c97 + last_write_checksum: sha1:285b2aaadf5dc0e96b4949009a4e352b5c67228b + pristine_git_object: 6652a9165edddeb2e349c7ecb1425da08dc93b52 + docs/models/multi-attach-price.md: + id: 24b09376a9bc + last_write_checksum: sha1:5093f3f7d158ce927d9703fa90a6ad05d2b58879 + pristine_git_object: 1f593609eb2e55d6a216ce47c5b4657e9e2ddd80 + docs/models/multi-attach-proration.md: + id: 6086395ced3f + last_write_checksum: sha1:bc0871bfe80b515731f2fb7daaa383e4a80c921c + pristine_git_object: 127455a3a6fe8aa51519cf273b38e7b4037e32cd + docs/models/multi-attach-redirect-mode.md: + id: f50c1627a691 + last_write_checksum: sha1:c2e60f24b6c1278f28237c65ff3134c9d4698cc3 + pristine_git_object: 771c5bc1c6efbcf8e33e06fd6b92779f6f3f4e6a + docs/models/multi-attach-required-action.md: + id: 65606b4924cb + last_write_checksum: sha1:6813fc8b13f549c2b5f5476b8668c4a1be4aeb9b + pristine_git_object: c45c50f16a9ec5562f1fda65a65f626f7fbd0e49 + docs/models/multi-attach-reset-interval.md: + id: a4ab17316d9c + last_write_checksum: sha1:8737611244dd67a2a2ac605882931f1cab4c155f + pristine_git_object: 6a6be7036534662b721613c989d5fae89eadfe09 + docs/models/multi-attach-reset.md: + id: a8370d7af059 + last_write_checksum: sha1:bd4b298e0b90a09d747ff585cc168ffbbb5b8d50 + pristine_git_object: ef47b4c79bd84d71a471b8ecc67dcc6201ccc5aa + docs/models/multi-attach-response.md: + id: b75042a0367e + last_write_checksum: sha1:713ddc8c16f74979df845f47422c0b9223121a11 + pristine_git_object: 35cf84e83f3d52d01f05ea1f16dbbb36069f3a87 + docs/models/multi-attach-rollover.md: + id: bb4a5e062977 + last_write_checksum: sha1:c14349746200b52c36ff396b838bad5eb348e8b5 + pristine_git_object: d23ca4ba2487bb7b457986a40239a354826ad1fa + docs/models/multi-attach-tier-behavior.md: + id: 6e6fb0c88a8f + last_write_checksum: sha1:886a4f6a6e04c4caf254f6a0917a2eb46b3c552f + pristine_git_object: 64026165734ddac858979b7fc0a545024914269d + docs/models/multi-attach-tier.md: + id: b98d5f82eb23 + last_write_checksum: sha1:3af71112f462f598e265a6bc135998773ab5afdf + pristine_git_object: 4d91210ad0827f1098c724f4c38e3aec8297f714 + docs/models/multi-attach-to.md: + id: 9cc63135019b + last_write_checksum: sha1:cb16b10293c7cd3917ccb6555fa95bc3c18ac65c + pristine_git_object: 6c21843fd4846a9fb1ea645b25a94269f564008e docs/models/open-customer-portal-globals.md: id: e0e501393359 last_write_checksum: sha1:eb5269be19a6426dfb429110bd750f61a9e2495d @@ -1208,8 +1396,8 @@ trackedFiles: pristine_git_object: 7b445ddbfcb5f1eaa4d64460de684010dbcc026f docs/models/plan-item-price.md: id: 8b84292b413d - last_write_checksum: sha1:7900678f68d040f299e43a94771577bc5f905c38 - pristine_git_object: 76428e62a026f32c7462222d3aff3712c3068c63 + last_write_checksum: sha1:a9d1c76045fe2e0324ee812948fe5282727076c4 + pristine_git_object: 4a9fd95017db3b2eb01dc61a1746234a05012f2a docs/models/plan-price-display.md: id: da4df629d91b last_write_checksum: sha1:bad027df2d61ccfabac1efb14fb38a05d40bf479 @@ -1238,10 +1426,14 @@ trackedFiles: id: 4705027a8146 last_write_checksum: sha1:8daa5d492f314a152924cf77cbd5abfba2cfdf51 pristine_git_object: ce6551a619ecf231881a602e7eff3f19a0df7d76 + docs/models/plan-tier-behavior.md: + id: 460cbe1aaa95 + last_write_checksum: sha1:e2a361ce89641eda51df68d8b4149ec17d0c7354 + pristine_git_object: eccc4d94d4a1ac29ff970f7e706e9f8b94611cfb docs/models/plan-tier.md: id: dd7f4ee452da - last_write_checksum: sha1:6c9c35eb92c09460deb94e964a11bcdb57b0d333 - pristine_git_object: c552d5ae4d5e527caf7ca9fc22a3ad272fd9caf3 + last_write_checksum: sha1:228c68fab301d3648bb11b185fd613b53d4c7fac + pristine_git_object: f16f46122cc547466672612ff0b7870645170c36 docs/models/plan-to.md: id: 265b5d85de02 last_write_checksum: sha1:73ba2dc4aa70a0e8dd181c625d49e195512a5aa8 @@ -1252,8 +1444,8 @@ trackedFiles: pristine_git_object: e573a1e61915a219fc68d1e31dd55c795dda4253 docs/models/plan.md: id: 900c4149ef4b - last_write_checksum: sha1:f5a64f4f525de38300eba5658097d087ac084574 - pristine_git_object: 4b2e0aaf440368a1d29a1a1a87149a162733b914 + last_write_checksum: sha1:62a2df64c93f1320fb1a1175222770ede624008b + pristine_git_object: e12ea4639ef56be38114ad4e493c05043a98e7f0 docs/models/preview-attach-attach-discount.md: id: b0e773c166f7 last_write_checksum: sha1:a6efccaad3aedb6172053dc61824402f891ff6ed @@ -1320,8 +1512,8 @@ trackedFiles: pristine_git_object: cc361cec667bc3532bc64a7ee9ce21b3ca889f9c docs/models/preview-attach-params.md: id: 29fbf5be911d - last_write_checksum: sha1:372a1345bfc5ba8d3b97d84ee7fa2675231fca2d - pristine_git_object: 23d14216228a59e8dd8382aa24ad6025c8e1f559 + last_write_checksum: sha1:dfa7768185ea6ba86a9948e5f059cb4773c871f4 + pristine_git_object: 21d26698a936959267b137c38550bf3465c44157 docs/models/preview-attach-plan-item.md: id: fc49e9185703 last_write_checksum: sha1:22ac4a20e6fc8104c0cf8d67add3bdf319ce2162 @@ -1336,8 +1528,8 @@ trackedFiles: pristine_git_object: 58e279131be4b1c368223d8695131de75d84caff docs/models/preview-attach-price.md: id: 73d456b81f1d - last_write_checksum: sha1:092fec67c7eff73f21262eee1441a8dfad746e9d - pristine_git_object: 48371b5da42eefec1c783919ff47d8d2850ad403 + last_write_checksum: sha1:c85f8dad2a40e49dec7077ceb0f491d526a6ae6a + pristine_git_object: de99696a76ce9d37633f936cfa8bf05add0ef438 docs/models/preview-attach-proration-behavior.md: id: f2c9f25246a9 last_write_checksum: sha1:68a0c755a60700e6ed45fb9ad6b5320f07de981b @@ -1362,14 +1554,142 @@ trackedFiles: id: 45bd31144856 last_write_checksum: sha1:3a2f09b2565a522e050a728c885e822640ba0793 pristine_git_object: 5c6b64e3be3f8032b12ac36edae7a98e4e1d9838 + docs/models/preview-attach-tier-behavior.md: + id: 9a9d362c4943 + last_write_checksum: sha1:c23b98d73513875a0c38a970c99f914158561ff9 + pristine_git_object: 990609000074b4b5d8cbe115fe6ee8d6f6dcb0d5 docs/models/preview-attach-tier.md: id: b673bbf7eb00 - last_write_checksum: sha1:87d34d121aa0319c6531a83054cd638e74a22f71 - pristine_git_object: d53b282977f7784aa5c38ddf68941399ef84c368 + last_write_checksum: sha1:97700adb98cb72a74abdd486961fa263e2d16da5 + pristine_git_object: 07403f657f0f24e372271252b5e5af29515fa75f docs/models/preview-attach-to.md: id: 030e7d9eb542 last_write_checksum: sha1:a99b9dda4fb20c320952c188259fd4a6f5f3a3db pristine_git_object: e7f0025357984088cebe4aa6f9af87ef6848d774 + docs/models/preview-multi-attach-attach-discount.md: + id: 964d991b7d57 + last_write_checksum: sha1:44a2776dce24509d8f8016c6bd55b1db0a28a506 + pristine_git_object: 6a1d0904c826a4e83eaae73c48f6917dedf79d25 + docs/models/preview-multi-attach-base-price.md: + id: 1411b3e0a887 + last_write_checksum: sha1:1f74d62b7198bf5e986f7af0c07cd52b8a0695e9 + pristine_git_object: 2c4b6c1f70e2eae9891821e6b5a1b34b1d9c64ad + docs/models/preview-multi-attach-billing-method.md: + id: 08a032b6436d + last_write_checksum: sha1:8d37dcbdb16b45192fd041922ebd564c88e67b22 + pristine_git_object: b5ac162f3668add1fb4436cc393f459c5da0b89f + docs/models/preview-multi-attach-customize.md: + id: 24a33dc900ca + last_write_checksum: sha1:b8a78a9a85c5b32cb395bd3550da68e3eed74ce4 + pristine_git_object: 0fd9fd9e163c067408efb9edb72a536cd7fe788f + docs/models/preview-multi-attach-discount.md: + id: f36f58b11c69 + last_write_checksum: sha1:16df08e3c6b1d177c1205e542c017c9c9618c7a4 + pristine_git_object: 85e0642ef931e238809fedd33555f4063a9bc60a + docs/models/preview-multi-attach-duration-type.md: + id: 50d19012c189 + last_write_checksum: sha1:203ae067ecb7edecdbf22f137d36c3415b6cedce + pristine_git_object: dbc402c93e888d8b48340ffc9d71b2d714c053c7 + docs/models/preview-multi-attach-entity-data.md: + id: c8bf894572ec + last_write_checksum: sha1:8dc7c8a629a51b10b27eee96e5d63b7f15066009 + pristine_git_object: 7ebdd9f311ff060ca07bbdc2ce6c40c5693de424 + docs/models/preview-multi-attach-expiry-duration-type.md: + id: 10b462a4f28c + last_write_checksum: sha1:82a2398dfedad663ded7ebc1bff5ee877521f6d5 + pristine_git_object: 83dd57b66200c0f4e2e347dab9156fafd4303469 + docs/models/preview-multi-attach-feature-quantity.md: + id: e12fbb6460f0 + last_write_checksum: sha1:eeb9fdf23caa8df4161d8eedfc1188d4fd48e4fa + pristine_git_object: 1e34e849871480c6fbb4bc40ce574ced6f6a9a4f + docs/models/preview-multi-attach-free-trial-params.md: + id: 7cf0ddce083a + last_write_checksum: sha1:52e7ae1e35c5de1ac34e50592e306b24f30b11f9 + pristine_git_object: 493e34e6c1b29fd3177f4780dcb133d730437b27 + docs/models/preview-multi-attach-globals.md: + id: c80a5d56ac8f + last_write_checksum: sha1:d5922beff003bfbb6c6bcd9f04c27773979b8966 + pristine_git_object: 835909b16de417210e6a775f2a9d7a490d224d28 + docs/models/preview-multi-attach-invoice-mode.md: + id: 3b06c211aa91 + last_write_checksum: sha1:409db019762a74dba3c766d3b08e1a26f0914862 + pristine_git_object: 058f60c61f3b7819e4720964b61087d05a401642 + docs/models/preview-multi-attach-item-price-interval.md: + id: 854f9244bd9c + last_write_checksum: sha1:91d806f61f0ad8845e617b2fff87f84a5d39fa39 + pristine_git_object: 62850c66eecb145d93b61097e3c69cb58eff2806 + docs/models/preview-multi-attach-line-item.md: + id: 58e5b232a13b + last_write_checksum: sha1:202b286b4b2bd8ae46b3b8bca6d8634e5781afc2 + pristine_git_object: aa9658b2f4675e3930c3be518b2b874f9a9dce01 + docs/models/preview-multi-attach-next-cycle.md: + id: 495141cb727a + last_write_checksum: sha1:9b03beccf723395a21f4436d8e34509cd1b91dba + pristine_git_object: 068f98eba4c89569fdd51a80f24c1f29290b1d28 + docs/models/preview-multi-attach-on-decrease.md: + id: 0e875a063e2d + last_write_checksum: sha1:eda9cc2cb7f65d0949d53fde13d8ea4eeec442cf + pristine_git_object: b5fbe04c93ecffa0bbdcb1eecc0c905495209657 + docs/models/preview-multi-attach-on-increase.md: + id: 4675d19a80cc + last_write_checksum: sha1:8e30d405d1c44bbc51080d12c722a58a8796e969 + pristine_git_object: 50e1c780a9ab648d2c2c974192ebb405bd3ae766 + docs/models/preview-multi-attach-params.md: + id: 2d749929bd2d + last_write_checksum: sha1:90f5ba02b2b4b815f8681f9fbc3fe980c63775b2 + pristine_git_object: 8313406882ae3ee175e402a97363203ace568904 + docs/models/preview-multi-attach-plan-item.md: + id: cc442912db93 + last_write_checksum: sha1:8a5d72e945773b5c411b3cd9a6ac92b24804047d + pristine_git_object: 85abc22788bdc6f5b20c757290b1a27052f994d0 + docs/models/preview-multi-attach-plan.md: + id: 6746a6182b93 + last_write_checksum: sha1:01b90192873a6b8093eab2a99a60321cad8a6162 + pristine_git_object: 359a332ed12ecfd6c05b8d5cfd0233e4eaee6558 + docs/models/preview-multi-attach-price-interval.md: + id: 9b3af4a96448 + last_write_checksum: sha1:a51c400b35447c5306eb1cbd812c92e11d3adc9a + pristine_git_object: c53e901075934172ee880b22624c7c76590eedaa + docs/models/preview-multi-attach-price.md: + id: 4f5d1d27c433 + last_write_checksum: sha1:0ea143dbf92f407cf25a4d7ded471e8432918614 + pristine_git_object: 0e629461e97927187b65161de8adb582ef1a3608 + docs/models/preview-multi-attach-proration.md: + id: d4e3816ec9ec + last_write_checksum: sha1:08fde5ace6ae31119dee347cbc815665f93e3653 + pristine_git_object: 49d0453b0f9777c878b374838ee717b86810c36b + docs/models/preview-multi-attach-redirect-mode.md: + id: 1a1d73de560b + last_write_checksum: sha1:e584c6959741cd0467995a581e0563fbecdccc9f + pristine_git_object: b0875c4d8bf6a7857af79fbb814e7b16ecfa4cc7 + docs/models/preview-multi-attach-reset-interval.md: + id: 3eb84a9e4f7e + last_write_checksum: sha1:5b866038bf462318495046e53055c1ce36dca101 + pristine_git_object: 467b034299b4a0c22f16760a4903097e476be1f5 + docs/models/preview-multi-attach-reset.md: + id: 736b7ccd5c8f + last_write_checksum: sha1:a936003991d41e7797f40ffd0e9693089c03836f + pristine_git_object: 76b0be7dd41f6656bd5af272c91fb99dea4f73b8 + docs/models/preview-multi-attach-response.md: + id: 9818ab87cd64 + last_write_checksum: sha1:a436a4596d41a99fc69e81fa4c1c64557973a5cc + pristine_git_object: e28b327e7ed902b455acb4d8e48ae5fb3beb8c55 + docs/models/preview-multi-attach-rollover.md: + id: 7d596d458a6d + last_write_checksum: sha1:45d89abe23cd4d317e88ba71370ad5dd8c0ea37c + pristine_git_object: ef5ca0b439b25e3b0d48bfe9c466e4fa807d8166 + docs/models/preview-multi-attach-tier-behavior.md: + id: 97ebd79496a2 + last_write_checksum: sha1:f4d075f16924dc8196791acb7b2091702dbcd3d5 + pristine_git_object: 97bb08e497b42743913774163b46ee4675a2dfd8 + docs/models/preview-multi-attach-tier.md: + id: 0340fba1ac43 + last_write_checksum: sha1:845334e616e4b577bf338e803d9659f7875de6ff + pristine_git_object: e27bbdda6b10fb8a8ad4c185f8fad1721b73dcd3 + docs/models/preview-multi-attach-to.md: + id: aeaac9479091 + last_write_checksum: sha1:ccfac3d8e2e623664f029fab1511d5d037676c6b + pristine_git_object: 3e72823c679b396e06dd5a48d7f9e7d316a5c3bf docs/models/preview-update-base-price.md: id: 2da5e78ec0e0 last_write_checksum: sha1:95ad92a8acddf51311af6689692c3954fdcccad2 @@ -1448,8 +1768,8 @@ trackedFiles: pristine_git_object: 7f8dcbca5b0000c9f63dc6218159983c72f14fd3 docs/models/preview-update-price.md: id: f1d2ea5fd71c - last_write_checksum: sha1:f4cf942fe1e6688f326b5ed6d21b34f0810afa91 - pristine_git_object: 5e45d8571bc15247c769550b42f24acd1b02959d + last_write_checksum: sha1:01bcc1b99fb1f9df629a31227439bdc8729d85a2 + pristine_git_object: e259ddb932bcc6fa2d4675170756c4e20b1548f0 docs/models/preview-update-proration-behavior.md: id: 0aa122be6a63 last_write_checksum: sha1:9410b7f6ca7266e83e638879c40359a2429bdec6 @@ -1474,18 +1794,22 @@ trackedFiles: id: fd27620d33af last_write_checksum: sha1:c02354fc996937d2d71acbf4c6938a20089ce1f1 pristine_git_object: 73f74a0da389040838507916ffc4cce5b41caa9a + docs/models/preview-update-tier-behavior.md: + id: 1df3addfb9f8 + last_write_checksum: sha1:88d62f29cb5e909062723ee6fa9aa32627b4c822 + pristine_git_object: d987d0cfe763eb80a8b311339ce2a02f264bced9 docs/models/preview-update-tier.md: id: 75b24899101d - last_write_checksum: sha1:043d1828e1666d7a17607c2fc9c09801408c978f - pristine_git_object: 6e170c5d8e1723ac8838fef1de72f53dc387a33c + last_write_checksum: sha1:fc03bcd217a477e97b3fe2c92b9fa2749bc62cb3 + pristine_git_object: 6a7aca3daf6e4536ad0327b609531366b7bb4d4d docs/models/preview-update-to.md: id: 3409c0c34539 last_write_checksum: sha1:45a0d4e4932f6d10d47d9f6f7a31805cb2056d12 pristine_git_object: fcda14627b67ed67632122647d46e2017e2d9406 docs/models/preview.md: id: ca71b601ef12 - last_write_checksum: sha1:aa806d7dd8515ee48400ccbae3f07b86b9694420 - pristine_git_object: d8d0ac14ea6dafffa2f62eccb094cca9f153c4bf + last_write_checksum: sha1:83b97643b438c9f8c649d8d15d7e8a20ef9eec96 + pristine_git_object: d38bd912d9225d833d01e2a9e0221a79ea19f0f6 docs/models/product-scenario.md: id: 53b34e452304 last_write_checksum: sha1:1b89a6c5aca71e11bc1c602eb29f5d7a5d62cdd8 @@ -1532,24 +1856,112 @@ trackedFiles: pristine_git_object: 4f9293c3e3617e496703fb7dc28a6947b8b03ff0 docs/models/scenario.md: id: e3aad8ab5efa - last_write_checksum: sha1:dea955e2e6537c03af820669075ace61a6d283be - pristine_git_object: 9d59212541bcf67d5332b474aaa48085a4be19a5 + last_write_checksum: sha1:892843746920753f6e54b1454d87a99d02ed671d + pristine_git_object: 16d08465a8dff1618ab98173702bff5b132377fc docs/models/security.md: id: 452e4d4eb67a last_write_checksum: sha1:d2af82412a97b139d12d416d11a235638001243b pristine_git_object: 314e31deee282b89d14d2a2ef710ee795c9a936c + docs/models/setup-payment-attach-discount.md: + id: f436872939eb + last_write_checksum: sha1:e56935f8b7678e9fe3e6c864e934170a7ed6893e + pristine_git_object: 48d618e57811e63de01d8ee23b8926f7a6fd2b6a + docs/models/setup-payment-base-price.md: + id: 7379e4922abd + last_write_checksum: sha1:9f1ec41e02ab0b0e9510c37a956b3d757a914416 + pristine_git_object: e5a8d298f69e4a75ae347989f53059bdb9c01e5b + docs/models/setup-payment-billing-method.md: + id: 44272f5847e2 + last_write_checksum: sha1:1dd5fce8009d1194985fd49e36482055df473f4d + pristine_git_object: 1720bf618b36b14a6d09237a411fc214f4815da1 + docs/models/setup-payment-customize.md: + id: d99db9e22611 + last_write_checksum: sha1:8cc1cb3402b7208ab98df8735b7629ceddf16d77 + pristine_git_object: 49d4ac999da58818c174c3f30bd9620455362141 + docs/models/setup-payment-duration-type.md: + id: b318c12dbec9 + last_write_checksum: sha1:641175152a85bb66d26c7226f4227cc8bddb00fb + pristine_git_object: 67b31ba463fb6164435afaf93dcb48da0749ad68 + docs/models/setup-payment-expiry-duration-type.md: + id: 549aafba8c4c + last_write_checksum: sha1:9302957bbae9ccfe85d43b66d6ae8b778837cd6c + pristine_git_object: b4421a41ff179345427d0809b6e3c4e31db737ac + docs/models/setup-payment-feature-quantity.md: + id: 442acc7d6d09 + last_write_checksum: sha1:442c66324f7faebbe037012c730aeb31cdc8fed0 + pristine_git_object: 9bae35e13f78165f6b9220db1377213bde03a3de + docs/models/setup-payment-free-trial-params.md: + id: 9ed79d1cd756 + last_write_checksum: sha1:e4ec4910111bc5c12454c36bef22d792aa8e4055 + pristine_git_object: e4d562de2e23b81ced3337205d0d579e7b20e713 docs/models/setup-payment-globals.md: id: 10b1bea5c60d last_write_checksum: sha1:bed0598b5ae5518236246d63749795cc6eaab50d pristine_git_object: 6e60d36b1bcaa5302444c8135670a8d24e2efc24 + docs/models/setup-payment-item-price-interval.md: + id: 603905abba5a + last_write_checksum: sha1:f755d4ed1b3d59dd24532def07c8865249ef1c1e + pristine_git_object: 409f1f495ee50329a599b5c0128482414a8bc666 + docs/models/setup-payment-on-decrease.md: + id: 66371b29fdee + last_write_checksum: sha1:ab1bbeac50ac54ac5a37e550617b48b9efee238f + pristine_git_object: 866b30b511672e1ed8fc5a4f8063721828a24b32 + docs/models/setup-payment-on-increase.md: + id: c18e12f8b3b6 + last_write_checksum: sha1:7eb8ade8ba8c8dc4aa9eff7f4004233d9cd52db8 + pristine_git_object: 17f67bc80a655ecb35a3af5a043712da68749e8d docs/models/setup-payment-params.md: id: 24c3d70301e8 - last_write_checksum: sha1:da6ad4cc65052521c59b17142eb1553792cda544 - pristine_git_object: cb913dbf5e49c2d45cf7ed53f52f068b14826796 + last_write_checksum: sha1:58f7a903d0104a1e2088e5c7e1fadb9714ab2988 + pristine_git_object: 4801315286472c65fa67bd4b4c13cbe55b8da412 + docs/models/setup-payment-plan-item.md: + id: 57c94716bfe5 + last_write_checksum: sha1:b253abb1fe3bd434dd0e9bcb5c06ff0a536ae5cf + pristine_git_object: 3ffa156985b29ae4e61745973a2fa58e456bb455 + docs/models/setup-payment-price-interval.md: + id: c533f31c34cc + last_write_checksum: sha1:1f7e5a0177cae1b371696bdc5124394f578844dd + pristine_git_object: c596f149d9aa75a02b42f0a3ed0d157b5d312c88 + docs/models/setup-payment-price.md: + id: f3e0b040e42f + last_write_checksum: sha1:76e0740357d05ff4f31cbf8dac30bb42ed3a87b8 + pristine_git_object: b959f2951d8aaf6afcaa16496477dc5d62872a68 + docs/models/setup-payment-proration-behavior.md: + id: eca79b890654 + last_write_checksum: sha1:eaaf437aa3d57ba24a4015392ce7ee1623b0a09d + pristine_git_object: 30b3437bbf91448180f47e010d442aa10040b8e3 + docs/models/setup-payment-proration.md: + id: 61b9068eccf3 + last_write_checksum: sha1:daced40130270ed3edbbd5ae94e64f7c837e9456 + pristine_git_object: ed234ac97753b706169026a4fe6338f4ed975611 + docs/models/setup-payment-reset-interval.md: + id: d8c821b0fc4d + last_write_checksum: sha1:931c38d2761118a4030a69fc8e32ddf28902ef89 + pristine_git_object: 065589b9e993369fdf0ac3e28d801507b2d75ff3 + docs/models/setup-payment-reset.md: + id: 699e44ff3571 + last_write_checksum: sha1:920f8ad88896d94fbe07ef18b22b48d66e1adb6a + pristine_git_object: 8ea0d822b908562ee611a92b02d25dcf679b2f3a docs/models/setup-payment-response.md: id: 9706acdb1f5d - last_write_checksum: sha1:e7fe8e1eaec81968a37dad8caaff5bf68d19e6bc - pristine_git_object: ecb9949b8f984a662874e0bb84cb4b467ed90abb + last_write_checksum: sha1:e11936ae1dd8e969bcbe07a7b69ec433da66041c + pristine_git_object: 8167bcd124d1a988869aa0b277f3c2ce7d2a7784 + docs/models/setup-payment-rollover.md: + id: 7ae145b1a607 + last_write_checksum: sha1:b8c88f238bb7ff4ee1bf6be71575688cf9ad08e2 + pristine_git_object: 6f323942e14b53581dd4e31cae8c8cc7017a1f24 + docs/models/setup-payment-tier-behavior.md: + id: 859e5911a700 + last_write_checksum: sha1:a245c56805e849ca17c778db935fce82f9c0bbcc + pristine_git_object: d900e2ee7bb731d7a11b54d2f18e79ff5e35dcfd + docs/models/setup-payment-tier.md: + id: 7c1bb99916d9 + last_write_checksum: sha1:c6e0ecbf531dd164c0c77d7de74188fe548ea6b6 + pristine_git_object: 181ac9e0dcbafd49214fc922166bf529df7032ef + docs/models/setup-payment-to.md: + id: dba59c3d0451 + last_write_checksum: sha1:9073877816389ba8348238d768e1f631fb145558 + pristine_git_object: b7b9632aa237c0e31e9935937f189e74801cd69a docs/models/status.md: id: 959cd204aadf last_write_checksum: sha1:08c58905f6c77c4ff486465c91970c69178eaded @@ -1564,8 +1976,8 @@ trackedFiles: pristine_git_object: ed4f767c1e16844e11dfcfadfd672a44d5e7489e docs/models/tiers.md: id: 06571cdb201f - last_write_checksum: sha1:528e8f9f8f896c27a7e1e137f6b2bdb697b26371 - pristine_git_object: 895d7d5d6434bd10d356e4b110a3bb5bdc48fe81 + last_write_checksum: sha1:9016326d0ce6eaf4f27a21ca29fe114032cbfcbf + pristine_git_object: 32920b0658ec1396c2bf91b0198e14964994f5c0 docs/models/total.md: id: f4060c3b4657 last_write_checksum: sha1:db27b4c0beb158424465eff3298baec188ae6bee @@ -1596,8 +2008,8 @@ trackedFiles: pristine_git_object: 926c9d23317270c16dd2b71f670b3a6a08eb0c5b docs/models/update-balance-params.md: id: 0a3afda4e55e - last_write_checksum: sha1:841b0560ec14ad14879b7782a0e07d3594d6a913 - pristine_git_object: 0b869f0d49882d117a1c132f11890f53abb0c64c + last_write_checksum: sha1:5b2cbba6f2c461bbb28986f617cda610ce8fb262 + pristine_git_object: d66ab34b7073dfedaa7a57fadd8201cef97952f5 docs/models/update-balance-response.md: id: d4d5020d6417 last_write_checksum: sha1:d2631ed8951ecffac9131fea4f5dba7cbf04a194 @@ -1682,6 +2094,10 @@ trackedFiles: id: acaf39d42386 last_write_checksum: sha1:af3af2720a587f377efbf14df3e586cc376ead26 pristine_git_object: c73b5150f3f0e1aaa0979420dbe2f370786bb626 + docs/models/update-plan-customer-eligibility.md: + id: b6b2db500bed + last_write_checksum: sha1:29d56730f1664793835b4909bd1e8c960cc9a72f + pristine_git_object: 6a1a759e1e1ee8ace9663106e3caa7169739093a docs/models/update-plan-duration-type-request.md: id: 52dbe07c25eb last_write_checksum: sha1:86b76dc24ebc1bf76e7d791b0b925dd772ec1d3f @@ -1732,8 +2148,8 @@ trackedFiles: pristine_git_object: 47c968da029557c2c8c0e37a6492c281aae4fefd docs/models/update-plan-item-price-response.md: id: ae8fef4236c2 - last_write_checksum: sha1:3ef8bd1627be10a987355572fd54bebaeafdc509 - pristine_git_object: 4537543a8e1df2eb639904b00cd52c9e699ffc03 + last_write_checksum: sha1:434af88a24564075d1cce3e7f82dfe57fb8e924c + pristine_git_object: 4e06391978f1e9f11290920eebc1edb6a65aed9a docs/models/update-plan-item.md: id: d9917caea5e5 last_write_checksum: sha1:b3f8dba86c631ca361652f7b474e4dc80bdaf154 @@ -1772,8 +2188,8 @@ trackedFiles: pristine_git_object: e3ffa074588d8dc4cc5ce76cbb57b0adcb537228 docs/models/update-plan-price-request.md: id: 4602b3ebb686 - last_write_checksum: sha1:4a775a42a33d30a0ac7bef9d4b7568aba6bcf7af - pristine_git_object: 6ac1d2ce4345318106e3c8ae61732dc9997bd823 + last_write_checksum: sha1:28611f36c1f91364a4e427c5746e381c07b7c7fa + pristine_git_object: 1a0d387a2415392ce095bf36b787ba21eae53fa2 docs/models/update-plan-price-response.md: id: 60c497fb4b67 last_write_checksum: sha1:15832c93a4476d978d026c896e7d18cb8a418540 @@ -1800,8 +2216,8 @@ trackedFiles: pristine_git_object: a91ea7b581af0524ec0a17e2d4dfecca576a5d68 docs/models/update-plan-response.md: id: 438137d6d905 - last_write_checksum: sha1:7bca6b3350e6ce3543c255a71caf762e0ecc016c - pristine_git_object: ebab15080d53593d6ce8b0a938d3f47f0f10417b + last_write_checksum: sha1:329a0b80646f3292472ff9cbab0b3ae0ab7568bb + pristine_git_object: c6ecdd729c185b0a631a16ba5efb9eab98dd0990 docs/models/update-plan-rollover-request.md: id: 70f500c0dfa8 last_write_checksum: sha1:c026dc1f10f556c1d984a92877814d06e27310b3 @@ -1810,14 +2226,26 @@ trackedFiles: id: d6683f4aae90 last_write_checksum: sha1:faa50304cb842ec3882fa8061fa676f154b0a0c4 pristine_git_object: 8bad9b30e3d3445904a7deab4bd769f28a412f44 + docs/models/update-plan-scenario.md: + id: c0f13803aa23 + last_write_checksum: sha1:c5735c62fe37a2e5f5e7bf096c5bf3a148968343 + pristine_git_object: c7dc0f5435ba12454136b846fa87629661231c85 + docs/models/update-plan-tier-behavior-request.md: + id: 8ce61fb8637e + last_write_checksum: sha1:b9e837d1016b53e5ba973bdb3aec0f63a3cd7bc0 + pristine_git_object: b027e08b063fed9b87885cae46a9fa282124596c + docs/models/update-plan-tier-behavior-response.md: + id: 4da31d438a94 + last_write_checksum: sha1:1db3f4e8189db73c50db0299bb5dca95165f57c7 + pristine_git_object: cd0aa9bf04621edd356628caa97a8c3bcad8395a docs/models/update-plan-tier-request.md: id: 0067947645f7 - last_write_checksum: sha1:f20bf92011ad03bb498a51a50d06e42f73e71f97 - pristine_git_object: 25ee574958787d4d04403d94502e378ea07b27d4 + last_write_checksum: sha1:8421845f4b9ab95e2b9d177943ed8bc9e38dbd87 + pristine_git_object: 43491bcbf329fe1f599cf64f360dbce3b664b9be docs/models/update-plan-tier-response.md: id: 47780329e7b3 - last_write_checksum: sha1:9fe9a5111627a422617ae1ce7393b5b1909c8dc9 - pristine_git_object: fd4d5aba2e130f732d8babf75e80c7879e8f63e3 + last_write_checksum: sha1:a3b22f131b2ed17508e24d5f2902210f49fa089b + pristine_git_object: 323ac914724a11efd94e36677ce6ad6194814d54 docs/models/update-plan-to-request.md: id: 74b5afa0a080 last_write_checksum: sha1:1ce7ca75b7e8711d0bd8a10eb207d2d1252949fd @@ -1848,8 +2276,8 @@ trackedFiles: pristine_git_object: fb242dffad941fbf1279dd86b439d776792395ed docs/sdks/billing/README.md: id: dc915331dd9d - last_write_checksum: sha1:1704af17f85d628107cb9e239b112e749a363995 - pristine_git_object: 5264aa3f66a18439e57e6641d9f294b5dda4aae1 + last_write_checksum: sha1:97ba12df6b242c060a943fdebc942212ccfa34c1 + pristine_git_object: f00d86e2a3a3d2a30aee6a7b491ef3da35b29df9 docs/sdks/customers/README.md: id: 9332759cffc2 last_write_checksum: sha1:77a118d627b03bf22d75641916ff2488bb0a672a @@ -1916,16 +2344,24 @@ trackedFiles: pristine_git_object: 5cbdc17fad50dd5fe969f2d3b3cb59a166b32049 src/funcs/billing-attach.ts: id: c23b3cd15f32 - last_write_checksum: sha1:9c996462a2ee13bbc2d8b9ad551c8c47e01f85a9 - pristine_git_object: 4decd6acf49c0c5359182e57b5e27ceda28bd961 + last_write_checksum: sha1:1986bb4906970adccee3f8f6d1ea0b800f91c793 + pristine_git_object: 8955f57b77c8c5f26f1c2793ccba985265bb60ef + src/funcs/billing-multi-attach.ts: + id: 67491e2d8249 + last_write_checksum: sha1:1f6359df265435a1b930af57f73cd94e52a0d6eb + pristine_git_object: 1ec0cdf94846069165735dfb63c9f0304473ebe9 src/funcs/billing-open-customer-portal.ts: id: bb88a88dc0c5 last_write_checksum: sha1:249539a12246269c58dc8568d65ed3b2cc4bacba pristine_git_object: fac46490864a5b712d2cc124e69e6cfcaca794f2 src/funcs/billing-preview-attach.ts: id: d262a9163889 - last_write_checksum: sha1:2f6d01bf9c45570920247daef947f9d8ed789289 - pristine_git_object: 4e345192c4cc75ccdf5e9e03319be8b25cdf03c1 + last_write_checksum: sha1:082c0d1ab7025afe42acb457d1a4c993597b2c33 + pristine_git_object: b55dbdaa93714fd177d20301c0016addf3630dee + src/funcs/billing-preview-multi-attach.ts: + id: 32ecebf960a5 + last_write_checksum: sha1:577e614f94744bc31b3e25243daf03d1f7599a6b + pristine_git_object: 104a2ea5718c4d0cca3ff3e50f762a2225208b05 src/funcs/billing-preview-update.ts: id: cd3a375787c5 last_write_checksum: sha1:4e999485db15acfaf23103215ba30e35882dd8ec @@ -2032,8 +2468,8 @@ trackedFiles: pristine_git_object: d37789d33ee1991fbd95bafeeab189ee5427c9b9 src/hooks/hooks.ts: id: a2463fc6f69b - last_write_checksum: sha1:7dd975bbcc46a32dd394f86a4652b74ecc70d874 - pristine_git_object: 7ed9e0445ac189e0f90687c6ef602212702bde90 + last_write_checksum: sha1:3a90d88b4c6c07247db8e5f6441a79538232394e + pristine_git_object: 94ad0a323123b34dc638717c5d67a3c23c54d5c6 src/hooks/index.ts: id: 5f2dab62b520 last_write_checksum: sha1:1a11c073a6cd792932218e1d4ed36b8567bad8ef @@ -2114,6 +2550,10 @@ trackedFiles: id: 4b7c98b18e2b last_write_checksum: sha1:f4fac86a8eaa22de6ee94d139021b6160e09c543 pristine_git_object: 112c7189b409fcf39b701080bd77772cc8b324f8 + src/models/attach-op.ts: + id: 83ed65c26ab4 + last_write_checksum: sha1:41f0d25a801e0906e807fee4492e6b674d0b6b36 + pristine_git_object: 9fa422dc959ae7ff0ecfc331ee6acce46e4b1e5b src/models/autumn-default-error.ts: id: 2528aa7886eb last_write_checksum: sha1:4cce18f91be3262ada7d11dcd6326544e2341b58 @@ -2124,20 +2564,16 @@ trackedFiles: pristine_git_object: 7cfcf2c90f1cfaa152ee2f4033187aa20b1c696b src/models/balance.ts: id: d7bbe0a7b446 - last_write_checksum: sha1:e122c3efdb664d9bf4f8c8d731bb309f055b97ba - pristine_git_object: b378971b319bfdc4b03988d5897df347bc70d004 - src/models/billing-attach-op.ts: - id: c0a94471ba75 - last_write_checksum: sha1:267c4f69e1cee87486fa5b15188c9c023f601a10 - pristine_git_object: 7de9aaa170ddc0ab9c89f79a7dcd6220432caff3 + last_write_checksum: sha1:c6d17f03f3e51d6ef0f85910ea6eaf724d6b4348 + pristine_git_object: b0f1fe0673307f30b85bf77d0e985aa413182a44 src/models/billing-update-op.ts: id: e7371769c7ca - last_write_checksum: sha1:97c6185dc9471d97a9c6c1988f701968ae0c537b - pristine_git_object: 4760caf902ff9b6afc9555526b91907013c7887c + last_write_checksum: sha1:2dbf611eef27c466192e93cee6a5afbe7a4be91a + pristine_git_object: 5ece9ccdc33e2bb4d1bfbdb8006a0a25bc8d993b src/models/check-op.ts: id: 42085bda016a - last_write_checksum: sha1:1f9e9edaefce1df7169788f6937f9253fef71d6d - pristine_git_object: 87c3479860700f36a991257defaf968738ebd3f0 + last_write_checksum: sha1:8c3ef0cffc5a6b3a67729278af57b8c257f119b1 + pristine_git_object: b4674590beb2b16ce95a844374f330808b01ff20 src/models/create-balance-op.ts: id: 537b8ff86863 last_write_checksum: sha1:9d1c1be246a8b9d0015b11184349fc404098a737 @@ -2152,8 +2588,8 @@ trackedFiles: pristine_git_object: 74a7f92cc3812461d09b81b1a85c7275026f2162 src/models/create-plan-op.ts: id: e094d152f358 - last_write_checksum: sha1:216459aae327409059f00953e311d2e1c8f08f5b - pristine_git_object: 2dadbeda0c90e7f1437ecc8347bedaeb2eb8e7ac + last_write_checksum: sha1:9fb48a484eb1f52781a8ea609a330e65e17f4dad + pristine_git_object: d7f3ac39233fe7c4602c1dc5602850b6c0bd360e src/models/create-referral-code-op.ts: id: 745cd70e7a69 last_write_checksum: sha1:01ce64d29c3bd84e0c9bf1e6a979e7e493f10d67 @@ -2200,16 +2636,16 @@ trackedFiles: pristine_git_object: 438cc17a1f829e2d6ccede223c04cf0fef9f9838 src/models/get-plan-op.ts: id: 91c8f8dda7c8 - last_write_checksum: sha1:05a95b9e7b6f5a61e919bb671a5e07239802002f - pristine_git_object: 7379a72330a8e06554ffd37b88070c9de5807cc0 + last_write_checksum: sha1:220eebad162a14699ca79794472a53f5cbea14f7 + pristine_git_object: 83cf86117088098797edecc06e699dfead61bac8 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:343ea73d379a17c58566a8c873e8b1bdace88eaa - pristine_git_object: bf70667b0b961d147e8efe17b75ae24d560add11 + last_write_checksum: sha1:ece90d52757cfbc6d2c6bee57b8a3243cb5337cd + pristine_git_object: d2d9acb1c3db3e96aa5101bc37ebe15c684257b9 src/models/list-customers-op.ts: id: b391692c8429 last_write_checksum: sha1:ffe17f0e9b360969793108bbf3404d9af5aff270 @@ -2224,24 +2660,32 @@ trackedFiles: pristine_git_object: 0f260a39a6ffe401412f6ad510b9e752acd42d3e src/models/list-plans-op.ts: id: 513cde894485 - last_write_checksum: sha1:8331c0fc740adf06d25340d263c3086b59b854a0 - pristine_git_object: 7d208a676f5e6cd6c9cab4e0fd7786182925f7f2 + last_write_checksum: sha1:31740d24df6831c30f2935c53c4e8e13f34ce211 + pristine_git_object: bd4fbef18fd6edec8920b3faa8c9f7e2c02d3ae4 + src/models/multi-attach-op.ts: + id: 99a2b77c1afc + last_write_checksum: sha1:316a0df83a8402a5403c45534b7e656df08e9f40 + pristine_git_object: 6488b19c7bc2d3587e0ca6d45ca9ac34fad5b538 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:00c9f716a1551bf19a9331830b0f8309c8f9d9dd - pristine_git_object: 532f8e2229d1cb10d65bc53a1dce4dc385b78aa3 + last_write_checksum: sha1:ee945ffc86d294de1f235e9ab966da65d1c47654 + pristine_git_object: ae6b0bdb1bdad3567defdb41b810c763c74b33fa src/models/preview-attach-op.ts: id: 3efc6e3443a7 - last_write_checksum: sha1:b1ef1849cf1be24eb8538b1beae8e73f5fcf7efd - pristine_git_object: 150c2ba69081ff4c0a76b48b5322a27bfedfc7f8 + last_write_checksum: sha1:ce5c49608e48ed00b5b73e9d2e2db12414ecf0ee + pristine_git_object: 6a8b3160172df67a55aa55e631a4aaed5eff4baf + src/models/preview-multi-attach-op.ts: + id: e4847dc281a6 + last_write_checksum: sha1:3a4aa4639dac9ab93e41eeb3b6ae8bb3c1491032 + pristine_git_object: 7be5d78afb1bc25780eddf4a8df9fc9069621c0d src/models/preview-update-op.ts: id: fcbbbf3b22ac - last_write_checksum: sha1:71de78d5f3f9cf7302083cccef8c5127559d3fb2 - pristine_git_object: a02027b298fb6148e76cfcaf066fea4a509df461 + last_write_checksum: sha1:0f2c46a3cfe6d39ea02885358181a078662cf8ca + pristine_git_object: 1eb45f9e916a5de336c1bfcf43bfcad4a043f230 src/models/redeem-referral-code-op.ts: id: 511bf73dc4c6 last_write_checksum: sha1:9ab6622018c82175ea98d2b26eadb4abf08f441a @@ -2260,16 +2704,16 @@ trackedFiles: pristine_git_object: 3774cc1e9bbb80ac592990aa86f8d4a38ee51f29 src/models/setup-payment-op.ts: id: 0e97e999ff3c - last_write_checksum: sha1:0dbff6b93495fba3ec80fabc8dcd8422e5f9014a - pristine_git_object: 96a093bc941edb66a4a35841e3bdc2bf32063c8d + last_write_checksum: sha1:ec1f5b0a5a9d498685c4c569aacd09dbf148ebc9 + pristine_git_object: 667ee39c968ce0bd5d2887c3dabed37343721e1f src/models/track-op.ts: id: 5e6a750e8fec last_write_checksum: sha1:7572221a1632911507ed9d43408d9eb7fd02f7a5 pristine_git_object: 7fae8517f5ba75be2b6f284878247cce5e746495 src/models/update-balance-op.ts: id: 69282313a00e - last_write_checksum: sha1:1390d07bc3905bdf61c59745d4f2b7138897c707 - pristine_git_object: 038d8ec3601fcf714640ad04912c83c19e04c0b5 + last_write_checksum: sha1:be83a4d10c82f997e1c448a778cee571289c3343 + pristine_git_object: 95459ecfa64bec3c8c408b00b2cc6f29cfd82835 src/models/update-customer-op.ts: id: 5d226d30d8e4 last_write_checksum: sha1:230c6a0c407ff292365e1d8b74f9d92f8c43b29f @@ -2280,16 +2724,16 @@ trackedFiles: pristine_git_object: b1b8e80440aa378657be836028b4bf806c6949b4 src/models/update-plan-op.ts: id: 54b4f842d3b2 - last_write_checksum: sha1:2c7495b206e974da4d89605a07815521a4b9cbe9 - pristine_git_object: 179071bc5598234e1911b2936bb1a2e04cebfbd4 + last_write_checksum: sha1:68a7c33a75aa081193aa24e0843df123bdc54ed9 + pristine_git_object: 84f576cea27a5ddeb75932e5545a5519ce75161f 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:cc29b3ba1732c6d6d2b23dd0fe4653be6ce8a773 - pristine_git_object: ca679c2d444e04997cb5b01f297a56defdb83132 + last_write_checksum: sha1:3547862876924b08579640beb046548bf0b923d5 + pristine_git_object: c810caa5f0804cd5491132f01c1e522de5b9057d src/sdk/customers.ts: id: d33e193e0c00 last_write_checksum: sha1:5a0593915cd17675d251336bdffc0182109f5c11 @@ -2668,10 +3112,10 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"customer_id": "cus_123", "plan_id": "pro_plan", "redirect_mode": "always"} + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan"} responses: "200": - application/json: {"customer_id": "cus_123", "payment_url": null} + application/json: {"customer_id": "cus_123", "payment_url": "https://checkout.stripe.com/..."} getOrCreate: speakeasy-default-get-or-create: parameters: @@ -2849,7 +3293,7 @@ examples: application/json: {"customer_id": "cus_123", "success_url": "https://example.com/account/billing"} responses: "200": - application/json: {"customer_id": "cus_123", "url": "https://courteous-emergent.name"} + application/json: {"customer_id": "cus_123", "url": "https://checkout.stripe.com/..."} previewBillingUpdate: speakeasy-default-preview-billing-update: parameters: @@ -3108,4 +3552,34 @@ examples: responses: "200": application/json: {"success": false} + billingMultiAttach: + speakeasy-default-billing-multi-attach: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plans": [{"plan_id": "pro_plan"}, {"plan_id": "addon_seats", "feature_quantities": [{"feature_id": "seats", "quantity": 5}]}], "redirect_mode": "if_required"} + responses: + "200": + application/json: {"customer_id": "cus_123", "invoice": {"status": "paid", "stripe_id": "in_1234", "total": 4900, "currency": "usd", "hosted_invoice_url": "https://invoice.stripe.com/..."}, "payment_url": null} + previewMultiAttach: + speakeasy-default-preview-multi-attach: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plans": [{"plan_id": "pro_plan"}, {"plan_id": "addon_seats", "feature_quantities": [{"feature_id": "seats", "quantity": 5}]}], "redirect_mode": "if_required"} + responses: + "200": + application/json: {"customer_id": "", "line_items": [{"title": "", "description": "as unfortunately wherever crest", "amount": 1446.82}], "total": 20, "currency": "usd"} + multiAttach: + speakeasy-default-multi-attach: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plans": [{"plan_id": "pro_plan"}, {"plan_id": "addon_seats", "feature_quantities": [{"feature_id": "seats", "quantity": 5}]}], "redirect_mode": "if_required"} + responses: + "200": + application/json: {"customer_id": "cus_123", "invoice": {"status": "paid", "stripe_id": "in_1234", "total": 4900, "currency": "usd", "hosted_invoice_url": "https://invoice.stripe.com/..."}, "payment_url": null} examplesVersion: 1.0.2 diff --git a/packages/sdk/.speakeasy/gen.yaml b/packages/sdk/.speakeasy/gen.yaml index 421683d4d..4821cc3ff 100644 --- a/packages/sdk/.speakeasy/gen.yaml +++ b/packages/sdk/.speakeasy/gen.yaml @@ -18,8 +18,8 @@ generation: sharedErrorComponentsApr2025: true sharedNestedComponentsJan2026: true auth: - oAuth2ClientCredentialsEnabled: true - oAuth2PasswordEnabled: true + oAuth2ClientCredentialsEnabled: false + oAuth2PasswordEnabled: false hoistGlobalSecurity: true inferSSEOverload: true sdkHooksConfigAccess: true diff --git a/packages/sdk/.speakeasy/out.openapi.yaml b/packages/sdk/.speakeasy/out.openapi.yaml index 6af7a57fc..f92519ff6 100644 --- a/packages/sdk/.speakeasy/out.openapi.yaml +++ b/packages/sdk/.speakeasy/out.openapi.yaml @@ -653,10 +653,14 @@ components: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. tier_behavior: enum: - graduated @@ -768,6 +772,26 @@ components: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + required: + - scenario required: - id - name @@ -954,6 +978,10 @@ components: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount @@ -2023,10 +2051,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -2349,10 +2381,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. tier_behavior: enum: - graduated @@ -2464,6 +2500,26 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + required: + - scenario required: - id - name @@ -2773,10 +2829,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. tier_behavior: enum: - graduated @@ -2888,6 +2948,26 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + required: + - scenario required: - id - name @@ -3175,10 +3255,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. tier_behavior: enum: - graduated @@ -3290,6 +3374,26 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + required: + - scenario required: - id - name @@ -3514,10 +3618,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -3826,10 +3934,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + description: Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. tier_behavior: enum: - graduated @@ -3941,6 +4053,26 @@ paths: - type: string - type: "null" description: If this is a variant, the ID of the base plan it was created from. + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + description: Whether a free trial is available for this customer. + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + description: The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + required: + - scenario required: - id - name @@ -4766,7 +4898,7 @@ paths: - *a1 /v1/billing.attach: post: - operationId: billingAttach + operationId: attach description: >- Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. @@ -4957,10 +5089,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -5198,7 +5334,7 @@ paths: - *a1 /v1/billing.multi_attach: post: - operationId: billingMultiAttach + operationId: multiAttach description: |- Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated. @@ -5339,10 +5475,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -5796,10 +5936,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -6176,10 +6320,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -6649,10 +6797,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -7033,10 +7185,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -7437,10 +7593,14 @@ paths: - const: inf amount: type: number + flat_amount: + anyOf: + - type: number + - type: "null" required: - to - amount - description: Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + description: Tiered pricing. Either 'amount' or 'tiers' is required. tier_behavior: enum: - graduated @@ -7997,6 +8157,11 @@ paths: amount: type: number description: The price of the product item for this tier. + flat_amount: + anyOf: + - type: number + - type: "null" + description: A flat fee charged for this tier, in addition to the per-unit amount. required: - to - amount diff --git a/packages/sdk/.speakeasy/workflow.lock b/packages/sdk/.speakeasy/workflow.lock index 6c6cb3c8c..8d2231a3d 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:13c128ac6c8d14e4b8798a7e20e5bfddbe23bc9d81acd823e7ce1bbd8094df51 - sourceBlobDigest: sha256:d0a67193a48e8da4c35f51c068715773f84b918076c1627eb9286794513f7f1b + sourceRevisionDigest: sha256:0e77060348da59b47343432bbbea51335e0a24d5b9d2f8421ded72c6b88f8219 + sourceBlobDigest: sha256:84fcb60481c185f7ad9256f109b8062d87ced544d9ac4af820463e9df9fd8849 tags: - latest - 2.1.0 @@ -25,10 +25,10 @@ targets: autumn-python: source: Autumn API Stripped sourceNamespace: autumn-api-stripped - sourceRevisionDigest: sha256:13c128ac6c8d14e4b8798a7e20e5bfddbe23bc9d81acd823e7ce1bbd8094df51 - sourceBlobDigest: sha256:d0a67193a48e8da4c35f51c068715773f84b918076c1627eb9286794513f7f1b + sourceRevisionDigest: sha256:0e77060348da59b47343432bbbea51335e0a24d5b9d2f8421ded72c6b88f8219 + sourceBlobDigest: sha256:84fcb60481c185f7ad9256f109b8062d87ced544d9ac4af820463e9df9fd8849 codeSamplesNamespace: autumn-api-python-code-samples - codeSamplesRevisionDigest: sha256:ce4215f239e65976dbfffcd7e5d76f506dc0ba33a3046a99f846502ff192fe71 + codeSamplesRevisionDigest: sha256:b00ce89ddc8577cb090cc62b69897399a86e097c20daa91df471c31e7aa09230 workflow: workflowVersion: 1.0.0 speakeasyVersion: pinned diff --git a/packages/sdk/README.md b/packages/sdk/README.md index c3ba84c24..4aa7ca331 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -246,6 +246,41 @@ const response = await client.billing.attach({ customerId: "cus_123", planId: "p @param successUrl - URL to redirect to after successful checkout. (optional) @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) +@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) + +@returns A billing response with customer ID, invoice details, and payment URL (if checkout required). +* [multiAttach](docs/sdks/billing/README.md#multiattach) - Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated. + +Use this endpoint when you need to subscribe a customer to multiple plans at once, such as a base plan plus add-ons, or to create a bundle of products. + +@example +```typescript +// Attach multiple plans to a customer +const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_seats","featureQuantities":[{"featureId":"seats","quantity":5}]}] }); +``` + +@example +```typescript +// Attach with free trial applied to all plans +const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_storage"}], freeTrial: {"durationLength":14,"durationType":"day"} }); +``` + +@example +```typescript +// Attach with custom pricing on one plan +const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan","customize":{"price":{"amount":4900,"interval":"month"}}},{"planId":"addon_support"}] }); +``` + +@param customerId - The ID of the customer to attach the plans to. +@param entityId - The ID of the entity to attach the plans to. (optional) +@param plans - The list of plans to attach to the customer. +@param freeTrial - Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. (optional) +@param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) +@param successUrl - URL to redirect to after successful checkout. (optional) +@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) +@param redirectMode - Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. (optional) +@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) @returns A billing response with customer ID, invoice details, and payment URL (if checkout required). * [previewAttach](docs/sdks/billing/README.md#previewattach) - Previews the billing changes that would occur when attaching a plan, without actually making any changes. @@ -270,8 +305,31 @@ const response = await client.billing.previewAttach({ customerId: "cus_123", pla @param successUrl - URL to redirect to after successful checkout. (optional) @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) +@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) @returns A preview response with line items, totals, and effective dates for the proposed changes. +* [previewMultiAttach](docs/sdks/billing/README.md#previewmultiattach) - Previews the billing changes that would occur when attaching multiple plans, without actually making any changes. + +Use this endpoint to show customers what they will be charged before confirming a multi-plan subscription. + +@example +```typescript +// Preview attaching multiple plans +const response = await client.billing.previewMultiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_seats","featureQuantities":[{"featureId":"seats","quantity":5}]}] }); +``` + +@param customerId - The ID of the customer to attach the plans to. +@param entityId - The ID of the entity to attach the plans to. (optional) +@param plans - The list of plans to attach to the customer. +@param freeTrial - Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. (optional) +@param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) +@param successUrl - URL to redirect to after successful checkout. (optional) +@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) +@param redirectMode - Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. (optional) +@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) + +@returns A preview response with line items, totals, and effective dates for the proposed multi-plan attachment. * [update](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. @@ -575,6 +633,41 @@ const response = await client.billing.attach({ customerId: "cus_123", planId: "p @param successUrl - URL to redirect to after successful checkout. (optional) @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) +@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) + +@returns A billing response with customer ID, invoice details, and payment URL (if checkout required). +- [`billingMultiAttach`](docs/sdks/billing/README.md#multiattach) - Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated. + +Use this endpoint when you need to subscribe a customer to multiple plans at once, such as a base plan plus add-ons, or to create a bundle of products. + +@example +```typescript +// Attach multiple plans to a customer +const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_seats","featureQuantities":[{"featureId":"seats","quantity":5}]}] }); +``` + +@example +```typescript +// Attach with free trial applied to all plans +const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_storage"}], freeTrial: {"durationLength":14,"durationType":"day"} }); +``` + +@example +```typescript +// Attach with custom pricing on one plan +const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan","customize":{"price":{"amount":4900,"interval":"month"}}},{"planId":"addon_support"}] }); +``` + +@param customerId - The ID of the customer to attach the plans to. +@param entityId - The ID of the entity to attach the plans to. (optional) +@param plans - The list of plans to attach to the customer. +@param freeTrial - Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. (optional) +@param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) +@param successUrl - URL to redirect to after successful checkout. (optional) +@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) +@param redirectMode - Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. (optional) +@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) @returns A billing response with customer ID, invoice details, and payment URL (if checkout required). - [`billingOpenCustomerPortal`](docs/sdks/billing/README.md#opencustomerportal) - Create a billing portal session for a customer to manage their subscription. @@ -600,8 +693,31 @@ const response = await client.billing.previewAttach({ customerId: "cus_123", pla @param successUrl - URL to redirect to after successful checkout. (optional) @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) +@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) @returns A preview response with line items, totals, and effective dates for the proposed changes. +- [`billingPreviewMultiAttach`](docs/sdks/billing/README.md#previewmultiattach) - Previews the billing changes that would occur when attaching multiple plans, without actually making any changes. + +Use this endpoint to show customers what they will be charged before confirming a multi-plan subscription. + +@example +```typescript +// Preview attaching multiple plans +const response = await client.billing.previewMultiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_seats","featureQuantities":[{"featureId":"seats","quantity":5}]}] }); +``` + +@param customerId - The ID of the customer to attach the plans to. +@param entityId - The ID of the entity to attach the plans to. (optional) +@param plans - The list of plans to attach to the customer. +@param freeTrial - Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. (optional) +@param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) +@param successUrl - URL to redirect to after successful checkout. (optional) +@param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) +@param redirectMode - Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. (optional) +@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) + +@returns A preview response with line items, totals, and effective dates for the proposed multi-plan attachment. - [`billingPreviewUpdate`](docs/sdks/billing/README.md#previewupdate) - Previews the billing changes that would occur when updating a subscription, without actually making any changes. Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. diff --git a/packages/sdk/src/funcs/billing-attach.ts b/packages/sdk/src/funcs/billing-attach.ts index 4decd6acf..8955f57b7 100644 --- a/packages/sdk/src/funcs/billing-attach.ts +++ b/packages/sdk/src/funcs/billing-attach.ts @@ -60,6 +60,7 @@ import { Result } from "../types/fp.js"; * @param successUrl - URL to redirect to after successful checkout. (optional) * @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) * @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + * @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) * * @returns A billing response with customer ID, invoice details, and payment URL (if checkout required). */ @@ -69,7 +70,7 @@ export function billingAttach( options?: RequestOptions, ): APIPromise< Result< - models.BillingAttachResponse, + models.AttachResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -94,7 +95,7 @@ async function $do( ): Promise< [ Result< - models.BillingAttachResponse, + models.AttachResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -137,7 +138,7 @@ async function $do( const context = { options: client._options, baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "billingAttach", + operationID: "attach", oAuth2Scopes: null, resolvedSecurity: requestSecurity, @@ -176,7 +177,7 @@ async function $do( const response = doResult.value; const [result] = await M.match< - models.BillingAttachResponse, + models.AttachResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -186,7 +187,7 @@ async function $do( | UnexpectedClientError | SDKValidationError >( - M.json(200, models.BillingAttachResponse$inboundSchema), + M.json(200, models.AttachResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"), )(response, req); diff --git a/packages/sdk/src/funcs/billing-multi-attach.ts b/packages/sdk/src/funcs/billing-multi-attach.ts new file mode 100644 index 000000000..1ec0cdf94 --- /dev/null +++ b/packages/sdk/src/funcs/billing-multi-attach.ts @@ -0,0 +1,196 @@ +/* + * 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"; + +/** + * Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated. + * + * Use this endpoint when you need to subscribe a customer to multiple plans at once, such as a base plan plus add-ons, or to create a bundle of products. + * + * @example + * ```typescript + * // Attach multiple plans to a customer + * const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_seats","featureQuantities":[{"featureId":"seats","quantity":5}]}] }); + * ``` + * + * @example + * ```typescript + * // Attach with free trial applied to all plans + * const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_storage"}], freeTrial: {"durationLength":14,"durationType":"day"} }); + * ``` + * + * @example + * ```typescript + * // Attach with custom pricing on one plan + * const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan","customize":{"price":{"amount":4900,"interval":"month"}}},{"planId":"addon_support"}] }); + * ``` + * + * @param customerId - The ID of the customer to attach the plans to. + * @param entityId - The ID of the entity to attach the plans to. (optional) + * @param plans - The list of plans to attach to the customer. + * @param freeTrial - Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. (optional) + * @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. (optional) + * @param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) + * @param successUrl - URL to redirect to after successful checkout. (optional) + * @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) + * @param redirectMode - Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. (optional) + * @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) + * + * @returns A billing response with customer ID, invoice details, and payment URL (if checkout required). + */ +export function billingMultiAttach( + client: AutumnCore, + request: models.MultiAttachParams, + options?: RequestOptions, +): APIPromise< + Result< + models.MultiAttachResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.MultiAttachParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.MultiAttachResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.MultiAttachParams$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.multi_attach")(); + + 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: "multiAttach", + 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.MultiAttachResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.MultiAttachResponse$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/billing-preview-attach.ts b/packages/sdk/src/funcs/billing-preview-attach.ts index 4e345192c..b55dbdaa9 100644 --- a/packages/sdk/src/funcs/billing-preview-attach.ts +++ b/packages/sdk/src/funcs/billing-preview-attach.ts @@ -48,6 +48,7 @@ import { Result } from "../types/fp.js"; * @param successUrl - URL to redirect to after successful checkout. (optional) * @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) * @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + * @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) * * @returns A preview response with line items, totals, and effective dates for the proposed changes. */ diff --git a/packages/sdk/src/funcs/billing-preview-multi-attach.ts b/packages/sdk/src/funcs/billing-preview-multi-attach.ts new file mode 100644 index 000000000..104a2ea57 --- /dev/null +++ b/packages/sdk/src/funcs/billing-preview-multi-attach.ts @@ -0,0 +1,184 @@ +/* + * 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"; + +/** + * Previews the billing changes that would occur when attaching multiple plans, without actually making any changes. + * + * Use this endpoint to show customers what they will be charged before confirming a multi-plan subscription. + * + * @example + * ```typescript + * // Preview attaching multiple plans + * const response = await client.billing.previewMultiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_seats","featureQuantities":[{"featureId":"seats","quantity":5}]}] }); + * ``` + * + * @param customerId - The ID of the customer to attach the plans to. + * @param entityId - The ID of the entity to attach the plans to. (optional) + * @param plans - The list of plans to attach to the customer. + * @param freeTrial - Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. (optional) + * @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. (optional) + * @param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) + * @param successUrl - URL to redirect to after successful checkout. (optional) + * @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) + * @param redirectMode - Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. (optional) + * @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) + * + * @returns A preview response with line items, totals, and effective dates for the proposed multi-plan attachment. + */ +export function billingPreviewMultiAttach( + client: AutumnCore, + request: models.PreviewMultiAttachParams, + options?: RequestOptions, +): APIPromise< + Result< + models.PreviewMultiAttachResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.PreviewMultiAttachParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.PreviewMultiAttachResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.PreviewMultiAttachParams$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.preview_multi_attach")(); + + 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: "previewMultiAttach", + 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.PreviewMultiAttachResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.PreviewMultiAttachResponse$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/hooks/hooks.ts b/packages/sdk/src/hooks/hooks.ts index 7ed9e0445..94ad0a323 100644 --- a/packages/sdk/src/hooks/hooks.ts +++ b/packages/sdk/src/hooks/hooks.ts @@ -18,8 +18,6 @@ import { SDKInitHook, } from "./types.js"; -import { initHooks } from "./registration.js"; - export class SDKHooks implements Hooks { sdkInitHooks: SDKInitHook[] = []; beforeCreateRequestHooks: BeforeCreateRequestHook[] = []; @@ -47,7 +45,6 @@ export class SDKHooks implements Hooks { this.registerAfterErrorHook(hook); } } - initHooks(this); } registerSDKInitHook(hook: SDKInitHook) { diff --git a/packages/sdk/src/models/billing-attach-op.ts b/packages/sdk/src/models/attach-op.ts similarity index 58% rename from packages/sdk/src/models/billing-attach-op.ts rename to packages/sdk/src/models/attach-op.ts index 7de9aaa17..9fa422dc9 100644 --- a/packages/sdk/src/models/billing-attach-op.ts +++ b/packages/sdk/src/models/attach-op.ts @@ -12,14 +12,14 @@ import * as types from "../types/primitives.js"; import { smartUnion } from "../types/smart-union.js"; import { SDKValidationError } from "./sdk-validation-error.js"; -export type BillingAttachGlobals = { +export type AttachGlobals = { xApiVersion?: string | undefined; }; /** * Quantity configuration for a prepaid feature. */ -export type BillingAttachFeatureQuantity = { +export type AttachFeatureQuantity = { /** * The ID of the feature to set quantity for. */ @@ -37,7 +37,7 @@ export type BillingAttachFeatureQuantity = { /** * Billing interval (e.g. 'month', 'year'). */ -export const BillingAttachPriceInterval = { +export const AttachPriceInterval = { OneOff: "one_off", Week: "week", Month: "month", @@ -48,14 +48,12 @@ export const BillingAttachPriceInterval = { /** * Billing interval (e.g. 'month', 'year'). */ -export type BillingAttachPriceInterval = ClosedEnum< - typeof BillingAttachPriceInterval ->; +export type AttachPriceInterval = ClosedEnum; /** * Base price configuration for a plan. */ -export type BillingAttachBasePrice = { +export type AttachBasePrice = { /** * Base price amount for the plan. */ @@ -63,7 +61,7 @@ export type BillingAttachBasePrice = { /** * Billing interval (e.g. 'month', 'year'). */ - interval: BillingAttachPriceInterval; + interval: AttachPriceInterval; /** * Number of intervals per billing cycle. Defaults to 1. */ @@ -73,7 +71,7 @@ export type BillingAttachBasePrice = { /** * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. */ -export const BillingAttachResetInterval = { +export const AttachResetInterval = { OneOff: "one_off", Minute: "minute", Hour: "hour", @@ -87,35 +85,40 @@ export const BillingAttachResetInterval = { /** * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. */ -export type BillingAttachResetInterval = ClosedEnum< - typeof BillingAttachResetInterval ->; +export type AttachResetInterval = ClosedEnum; /** * Reset configuration for consumable features. Omit for non-consumable features like seats. */ -export type BillingAttachReset = { +export type AttachReset = { /** * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. */ - interval: BillingAttachResetInterval; + interval: AttachResetInterval; /** * Number of intervals between resets. Defaults to 1. */ intervalCount?: number | undefined; }; -export type BillingAttachTo = number | string; +export type AttachTo = number | string; -export type BillingAttachTier = { +export type AttachTier = { to: number | string; amount: number; + flatAmount?: number | null | undefined; }; +export const AttachTierBehavior = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type AttachTierBehavior = ClosedEnum; + /** * Billing interval. For consumable features, should match reset.interval. */ -export const BillingAttachItemPriceInterval = { +export const AttachItemPriceInterval = { OneOff: "one_off", Week: "week", Month: "month", @@ -126,40 +129,39 @@ export const BillingAttachItemPriceInterval = { /** * Billing interval. For consumable features, should match reset.interval. */ -export type BillingAttachItemPriceInterval = ClosedEnum< - typeof BillingAttachItemPriceInterval +export type AttachItemPriceInterval = ClosedEnum< + typeof AttachItemPriceInterval >; /** * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. */ -export const BillingAttachBillingMethod = { +export const AttachBillingMethod = { 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 ->; +export type AttachBillingMethod = ClosedEnum; /** * Pricing for usage beyond included units. Omit for free features. */ -export type BillingAttachPrice = { +export type AttachPrice = { /** * 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. + * Tiered pricing. Either 'amount' or 'tiers' is required. */ - tiers?: Array | undefined; + tiers?: Array | undefined; + tierBehavior?: AttachTierBehavior | undefined; /** * Billing interval. For consumable features, should match reset.interval. */ - interval: BillingAttachItemPriceInterval; + interval: AttachItemPriceInterval; /** * Number of intervals per billing cycle. Defaults to 1. */ @@ -171,7 +173,7 @@ export type BillingAttachPrice = { /** * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. */ - billingMethod: BillingAttachBillingMethod; + billingMethod: AttachBillingMethod; /** * Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. */ @@ -181,7 +183,7 @@ export type BillingAttachPrice = { /** * Billing behavior when quantity increases mid-cycle. */ -export const BillingAttachOnIncrease = { +export const AttachOnIncrease = { BillImmediately: "bill_immediately", ProrateImmediately: "prorate_immediately", ProrateNextCycle: "prorate_next_cycle", @@ -190,14 +192,12 @@ export const BillingAttachOnIncrease = { /** * Billing behavior when quantity increases mid-cycle. */ -export type BillingAttachOnIncrease = ClosedEnum< - typeof BillingAttachOnIncrease ->; +export type AttachOnIncrease = ClosedEnum; /** * Credit behavior when quantity decreases mid-cycle. */ -export const BillingAttachOnDecrease = { +export const AttachOnDecrease = { Prorate: "prorate", ProrateImmediately: "prorate_immediately", ProrateNextCycle: "prorate_next_cycle", @@ -207,42 +207,40 @@ export const BillingAttachOnDecrease = { /** * Credit behavior when quantity decreases mid-cycle. */ -export type BillingAttachOnDecrease = ClosedEnum< - typeof BillingAttachOnDecrease ->; +export type AttachOnDecrease = ClosedEnum; /** * Proration settings for prepaid features. Controls mid-cycle quantity change billing. */ -export type BillingAttachProration = { +export type AttachProration = { /** * Billing behavior when quantity increases mid-cycle. */ - onIncrease: BillingAttachOnIncrease; + onIncrease: AttachOnIncrease; /** * Credit behavior when quantity decreases mid-cycle. */ - onDecrease: BillingAttachOnDecrease; + onDecrease: AttachOnDecrease; }; /** * When rolled over units expire. */ -export const BillingAttachExpiryDurationType = { +export const AttachExpiryDurationType = { Month: "month", Forever: "forever", } as const; /** * When rolled over units expire. */ -export type BillingAttachExpiryDurationType = ClosedEnum< - typeof BillingAttachExpiryDurationType +export type AttachExpiryDurationType = ClosedEnum< + typeof AttachExpiryDurationType >; /** * Rollover config for unused units. If set, unused included units carry over. */ -export type BillingAttachRollover = { +export type AttachRollover = { /** * Max rollover units. Omit for unlimited rollover. */ @@ -250,7 +248,7 @@ export type BillingAttachRollover = { /** * When rolled over units expire. */ - expiryDurationType: BillingAttachExpiryDurationType; + expiryDurationType: AttachExpiryDurationType; /** * Number of periods before expiry. */ @@ -260,7 +258,7 @@ export type BillingAttachRollover = { /** * Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings. */ -export type BillingAttachPlanItem = { +export type AttachPlanItem = { /** * The ID of the feature to configure. */ @@ -276,25 +274,25 @@ export type BillingAttachPlanItem = { /** * Reset configuration for consumable features. Omit for non-consumable features like seats. */ - reset?: BillingAttachReset | undefined; + reset?: AttachReset | undefined; /** * Pricing for usage beyond included units. Omit for free features. */ - price?: BillingAttachPrice | undefined; + price?: AttachPrice | undefined; /** * Proration settings for prepaid features. Controls mid-cycle quantity change billing. */ - proration?: BillingAttachProration | undefined; + proration?: AttachProration | undefined; /** * Rollover config for unused units. If set, unused included units carry over. */ - rollover?: BillingAttachRollover | undefined; + rollover?: AttachRollover | undefined; }; /** * Unit of time for the trial ('day', 'month', 'year'). */ -export const BillingAttachDurationType = { +export const AttachDurationType = { Day: "day", Month: "month", Year: "year", @@ -302,14 +300,12 @@ export const BillingAttachDurationType = { /** * Unit of time for the trial ('day', 'month', 'year'). */ -export type BillingAttachDurationType = ClosedEnum< - typeof BillingAttachDurationType ->; +export type AttachDurationType = ClosedEnum; /** * Free trial configuration for a plan. */ -export type BillingAttachFreeTrialParams = { +export type AttachFreeTrialParams = { /** * Number of duration_type periods the trial lasts. */ @@ -317,7 +313,7 @@ export type BillingAttachFreeTrialParams = { /** * Unit of time for the trial ('day', 'month', 'year'). */ - durationType?: BillingAttachDurationType | undefined; + durationType?: AttachDurationType | undefined; /** * If true, payment method required to start trial. Customer is charged after trial ends. */ @@ -327,25 +323,25 @@ export type BillingAttachFreeTrialParams = { /** * Customize the plan to attach. Can override the price, items, free trial, or a combination. */ -export type BillingAttachCustomize = { +export type AttachCustomize = { /** * Override the base price of the plan. Pass null to remove the base price. */ - price?: BillingAttachBasePrice | null | undefined; + price?: AttachBasePrice | null | undefined; /** * Override the items in the plan. */ - items?: Array | undefined; + items?: Array | undefined; /** * Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. */ - freeTrial?: BillingAttachFreeTrialParams | null | undefined; + freeTrial?: AttachFreeTrialParams | null | undefined; }; /** * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. */ -export type BillingAttachInvoiceMode = { +export type AttachInvoiceMode = { /** * When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. */ @@ -363,21 +359,21 @@ export type BillingAttachInvoiceMode = { /** * How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. */ -export const BillingAttachProrationBehavior = { +export const AttachProrationBehavior = { ProrateImmediately: "prorate_immediately", None: "none", } as const; /** * How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. */ -export type BillingAttachProrationBehavior = ClosedEnum< - typeof BillingAttachProrationBehavior +export type AttachProrationBehavior = ClosedEnum< + typeof AttachProrationBehavior >; /** * A discount to apply. Can be either a reward ID or a promotion code. */ -export type BillingAttachAttachDiscount = { +export type AttachAttachDiscount = { /** * The ID of the reward to apply as a discount. */ @@ -391,16 +387,14 @@ export type BillingAttachAttachDiscount = { /** * When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. */ -export const BillingAttachPlanSchedule = { +export const AttachPlanSchedule = { Immediate: "immediate", EndOfCycle: "end_of_cycle", } as const; /** * When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. */ -export type BillingAttachPlanSchedule = ClosedEnum< - typeof BillingAttachPlanSchedule ->; +export type AttachPlanSchedule = ClosedEnum; export type AttachParams = { /** @@ -418,7 +412,7 @@ export type AttachParams = { /** * If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. */ - featureQuantities?: Array | undefined; + featureQuantities?: Array | undefined; /** * The version of the plan to attach. */ @@ -426,19 +420,19 @@ export type AttachParams = { /** * Customize the plan to attach. Can override the price, items, free trial, or a combination. */ - customize?: BillingAttachCustomize | undefined; + customize?: AttachCustomize | undefined; /** * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. */ - invoiceMode?: BillingAttachInvoiceMode | undefined; + invoiceMode?: AttachInvoiceMode | undefined; /** * How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. */ - prorationBehavior?: BillingAttachProrationBehavior | undefined; + prorationBehavior?: AttachProrationBehavior | undefined; /** * List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. */ - discounts?: Array | undefined; + discounts?: Array | undefined; /** * URL to redirect to after successful checkout. */ @@ -450,13 +444,17 @@ export type AttachParams = { /** * When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. */ - planSchedule?: BillingAttachPlanSchedule | undefined; + planSchedule?: AttachPlanSchedule | undefined; + /** + * Additional parameters to pass into the creation of the Stripe checkout session. + */ + checkoutSessionParams?: { [k: string]: any } | undefined; }; /** * Invoice details if an invoice was created. Only present when a charge was made. */ -export type BillingAttachInvoice = { +export type AttachInvoice = { /** * The status of the invoice (e.g., 'paid', 'open', 'draft'). */ @@ -482,7 +480,7 @@ export type BillingAttachInvoice = { /** * The type of action required to complete the payment. */ -export const BillingAttachCode = { +export const AttachCode = { ThreedsRequired: "3ds_required", PaymentMethodRequired: "payment_method_required", PaymentFailed: "payment_failed", @@ -490,16 +488,16 @@ export const BillingAttachCode = { /** * The type of action required to complete the payment. */ -export type BillingAttachCode = OpenEnum; +export type AttachCode = OpenEnum; /** * Details about any action required to complete the payment. Present when the payment could not be processed automatically. */ -export type BillingAttachRequiredAction = { +export type AttachRequiredAction = { /** * The type of action required to complete the payment. */ - code: BillingAttachCode; + code: AttachCode; /** * A human-readable explanation of why this action is required. */ @@ -509,7 +507,7 @@ export type BillingAttachRequiredAction = { /** * OK */ -export type BillingAttachResponse = { +export type AttachResponse = { /** * The ID of the customer. */ @@ -521,7 +519,7 @@ export type BillingAttachResponse = { /** * Invoice details if an invoice was created. Only present when a charge was made. */ - invoice?: BillingAttachInvoice | undefined; + invoice?: AttachInvoice | undefined; /** * URL to redirect the customer to complete payment. Null if no payment action is required. */ @@ -529,20 +527,20 @@ export type BillingAttachResponse = { /** * Details about any action required to complete the payment. Present when the payment could not be processed automatically. */ - requiredAction?: BillingAttachRequiredAction | undefined; + requiredAction?: AttachRequiredAction | undefined; }; /** @internal */ -export type BillingAttachFeatureQuantity$Outbound = { +export type AttachFeatureQuantity$Outbound = { feature_id: string; quantity?: number | undefined; adjustable?: boolean | undefined; }; /** @internal */ -export const BillingAttachFeatureQuantity$outboundSchema: z.ZodMiniType< - BillingAttachFeatureQuantity$Outbound, - BillingAttachFeatureQuantity +export const AttachFeatureQuantity$outboundSchema: z.ZodMiniType< + AttachFeatureQuantity$Outbound, + AttachFeatureQuantity > = z.pipe( z.object({ featureId: z.string(), @@ -556,36 +554,34 @@ export const BillingAttachFeatureQuantity$outboundSchema: z.ZodMiniType< }), ); -export function billingAttachFeatureQuantityToJSON( - billingAttachFeatureQuantity: BillingAttachFeatureQuantity, +export function attachFeatureQuantityToJSON( + attachFeatureQuantity: AttachFeatureQuantity, ): string { return JSON.stringify( - BillingAttachFeatureQuantity$outboundSchema.parse( - billingAttachFeatureQuantity, - ), + AttachFeatureQuantity$outboundSchema.parse(attachFeatureQuantity), ); } /** @internal */ -export const BillingAttachPriceInterval$outboundSchema: z.ZodMiniEnum< - typeof BillingAttachPriceInterval -> = z.enum(BillingAttachPriceInterval); +export const AttachPriceInterval$outboundSchema: z.ZodMiniEnum< + typeof AttachPriceInterval +> = z.enum(AttachPriceInterval); /** @internal */ -export type BillingAttachBasePrice$Outbound = { +export type AttachBasePrice$Outbound = { amount: number; interval: string; interval_count?: number | undefined; }; /** @internal */ -export const BillingAttachBasePrice$outboundSchema: z.ZodMiniType< - BillingAttachBasePrice$Outbound, - BillingAttachBasePrice +export const AttachBasePrice$outboundSchema: z.ZodMiniType< + AttachBasePrice$Outbound, + AttachBasePrice > = z.pipe( z.object({ amount: z.number(), - interval: BillingAttachPriceInterval$outboundSchema, + interval: AttachPriceInterval$outboundSchema, intervalCount: z.optional(z.number()), }), z.transform((v) => { @@ -595,32 +591,30 @@ export const BillingAttachBasePrice$outboundSchema: z.ZodMiniType< }), ); -export function billingAttachBasePriceToJSON( - billingAttachBasePrice: BillingAttachBasePrice, +export function attachBasePriceToJSON( + attachBasePrice: AttachBasePrice, ): string { - return JSON.stringify( - BillingAttachBasePrice$outboundSchema.parse(billingAttachBasePrice), - ); + return JSON.stringify(AttachBasePrice$outboundSchema.parse(attachBasePrice)); } /** @internal */ -export const BillingAttachResetInterval$outboundSchema: z.ZodMiniEnum< - typeof BillingAttachResetInterval -> = z.enum(BillingAttachResetInterval); +export const AttachResetInterval$outboundSchema: z.ZodMiniEnum< + typeof AttachResetInterval +> = z.enum(AttachResetInterval); /** @internal */ -export type BillingAttachReset$Outbound = { +export type AttachReset$Outbound = { interval: string; interval_count?: number | undefined; }; /** @internal */ -export const BillingAttachReset$outboundSchema: z.ZodMiniType< - BillingAttachReset$Outbound, - BillingAttachReset +export const AttachReset$outboundSchema: z.ZodMiniType< + AttachReset$Outbound, + AttachReset > = z.pipe( z.object({ - interval: BillingAttachResetInterval$outboundSchema, + interval: AttachResetInterval$outboundSchema, intervalCount: z.optional(z.number()), }), z.transform((v) => { @@ -630,66 +624,71 @@ export const BillingAttachReset$outboundSchema: z.ZodMiniType< }), ); -export function billingAttachResetToJSON( - billingAttachReset: BillingAttachReset, -): string { - return JSON.stringify( - BillingAttachReset$outboundSchema.parse(billingAttachReset), - ); +export function attachResetToJSON(attachReset: AttachReset): string { + return JSON.stringify(AttachReset$outboundSchema.parse(attachReset)); } /** @internal */ -export type BillingAttachTo$Outbound = number | string; +export type AttachTo$Outbound = number | string; /** @internal */ -export const BillingAttachTo$outboundSchema: z.ZodMiniType< - BillingAttachTo$Outbound, - BillingAttachTo +export const AttachTo$outboundSchema: z.ZodMiniType< + AttachTo$Outbound, + AttachTo > = smartUnion([z.number(), z.string()]); -export function billingAttachToToJSON( - billingAttachTo: BillingAttachTo, -): string { - return JSON.stringify(BillingAttachTo$outboundSchema.parse(billingAttachTo)); +export function attachToToJSON(attachTo: AttachTo): string { + return JSON.stringify(AttachTo$outboundSchema.parse(attachTo)); } /** @internal */ -export type BillingAttachTier$Outbound = { +export type AttachTier$Outbound = { to: number | string; amount: number; + flat_amount?: number | null | undefined; }; /** @internal */ -export const BillingAttachTier$outboundSchema: z.ZodMiniType< - BillingAttachTier$Outbound, - BillingAttachTier -> = z.object({ - to: smartUnion([z.number(), z.string()]), - amount: z.number(), -}); +export const AttachTier$outboundSchema: z.ZodMiniType< + AttachTier$Outbound, + AttachTier +> = z.pipe( + z.object({ + to: smartUnion([z.number(), z.string()]), + amount: z.number(), + flatAmount: z.optional(z.nullable(z.number())), + }), + z.transform((v) => { + return remap$(v, { + flatAmount: "flat_amount", + }); + }), +); -export function billingAttachTierToJSON( - billingAttachTier: BillingAttachTier, -): string { - return JSON.stringify( - BillingAttachTier$outboundSchema.parse(billingAttachTier), - ); +export function attachTierToJSON(attachTier: AttachTier): string { + return JSON.stringify(AttachTier$outboundSchema.parse(attachTier)); } /** @internal */ -export const BillingAttachItemPriceInterval$outboundSchema: z.ZodMiniEnum< - typeof BillingAttachItemPriceInterval -> = z.enum(BillingAttachItemPriceInterval); +export const AttachTierBehavior$outboundSchema: z.ZodMiniEnum< + typeof AttachTierBehavior +> = z.enum(AttachTierBehavior); /** @internal */ -export const BillingAttachBillingMethod$outboundSchema: z.ZodMiniEnum< - typeof BillingAttachBillingMethod -> = z.enum(BillingAttachBillingMethod); +export const AttachItemPriceInterval$outboundSchema: z.ZodMiniEnum< + typeof AttachItemPriceInterval +> = z.enum(AttachItemPriceInterval); /** @internal */ -export type BillingAttachPrice$Outbound = { +export const AttachBillingMethod$outboundSchema: z.ZodMiniEnum< + typeof AttachBillingMethod +> = z.enum(AttachBillingMethod); + +/** @internal */ +export type AttachPrice$Outbound = { amount?: number | undefined; - tiers?: Array | undefined; + tiers?: Array | undefined; + tier_behavior?: string | undefined; interval: string; interval_count: number; billing_units: number; @@ -698,21 +697,23 @@ export type BillingAttachPrice$Outbound = { }; /** @internal */ -export const BillingAttachPrice$outboundSchema: z.ZodMiniType< - BillingAttachPrice$Outbound, - BillingAttachPrice +export const AttachPrice$outboundSchema: z.ZodMiniType< + AttachPrice$Outbound, + AttachPrice > = z.pipe( z.object({ amount: z.optional(z.number()), - tiers: z.optional(z.array(z.lazy(() => BillingAttachTier$outboundSchema))), - interval: BillingAttachItemPriceInterval$outboundSchema, + tiers: z.optional(z.array(z.lazy(() => AttachTier$outboundSchema))), + tierBehavior: z.optional(AttachTierBehavior$outboundSchema), + interval: AttachItemPriceInterval$outboundSchema, intervalCount: z._default(z.number(), 1), billingUnits: z._default(z.number(), 1), - billingMethod: BillingAttachBillingMethod$outboundSchema, + billingMethod: AttachBillingMethod$outboundSchema, maxPurchase: z.optional(z.number()), }), z.transform((v) => { return remap$(v, { + tierBehavior: "tier_behavior", intervalCount: "interval_count", billingUnits: "billing_units", billingMethod: "billing_method", @@ -721,38 +722,34 @@ export const BillingAttachPrice$outboundSchema: z.ZodMiniType< }), ); -export function billingAttachPriceToJSON( - billingAttachPrice: BillingAttachPrice, -): string { - return JSON.stringify( - BillingAttachPrice$outboundSchema.parse(billingAttachPrice), - ); +export function attachPriceToJSON(attachPrice: AttachPrice): string { + return JSON.stringify(AttachPrice$outboundSchema.parse(attachPrice)); } /** @internal */ -export const BillingAttachOnIncrease$outboundSchema: z.ZodMiniEnum< - typeof BillingAttachOnIncrease -> = z.enum(BillingAttachOnIncrease); +export const AttachOnIncrease$outboundSchema: z.ZodMiniEnum< + typeof AttachOnIncrease +> = z.enum(AttachOnIncrease); /** @internal */ -export const BillingAttachOnDecrease$outboundSchema: z.ZodMiniEnum< - typeof BillingAttachOnDecrease -> = z.enum(BillingAttachOnDecrease); +export const AttachOnDecrease$outboundSchema: z.ZodMiniEnum< + typeof AttachOnDecrease +> = z.enum(AttachOnDecrease); /** @internal */ -export type BillingAttachProration$Outbound = { +export type AttachProration$Outbound = { on_increase: string; on_decrease: string; }; /** @internal */ -export const BillingAttachProration$outboundSchema: z.ZodMiniType< - BillingAttachProration$Outbound, - BillingAttachProration +export const AttachProration$outboundSchema: z.ZodMiniType< + AttachProration$Outbound, + AttachProration > = z.pipe( z.object({ - onIncrease: BillingAttachOnIncrease$outboundSchema, - onDecrease: BillingAttachOnDecrease$outboundSchema, + onIncrease: AttachOnIncrease$outboundSchema, + onDecrease: AttachOnDecrease$outboundSchema, }), z.transform((v) => { return remap$(v, { @@ -762,34 +759,32 @@ export const BillingAttachProration$outboundSchema: z.ZodMiniType< }), ); -export function billingAttachProrationToJSON( - billingAttachProration: BillingAttachProration, +export function attachProrationToJSON( + attachProration: AttachProration, ): string { - return JSON.stringify( - BillingAttachProration$outboundSchema.parse(billingAttachProration), - ); + return JSON.stringify(AttachProration$outboundSchema.parse(attachProration)); } /** @internal */ -export const BillingAttachExpiryDurationType$outboundSchema: z.ZodMiniEnum< - typeof BillingAttachExpiryDurationType -> = z.enum(BillingAttachExpiryDurationType); +export const AttachExpiryDurationType$outboundSchema: z.ZodMiniEnum< + typeof AttachExpiryDurationType +> = z.enum(AttachExpiryDurationType); /** @internal */ -export type BillingAttachRollover$Outbound = { +export type AttachRollover$Outbound = { max?: number | undefined; expiry_duration_type: string; expiry_duration_length?: number | undefined; }; /** @internal */ -export const BillingAttachRollover$outboundSchema: z.ZodMiniType< - BillingAttachRollover$Outbound, - BillingAttachRollover +export const AttachRollover$outboundSchema: z.ZodMiniType< + AttachRollover$Outbound, + AttachRollover > = z.pipe( z.object({ max: z.optional(z.number()), - expiryDurationType: BillingAttachExpiryDurationType$outboundSchema, + expiryDurationType: AttachExpiryDurationType$outboundSchema, expiryDurationLength: z.optional(z.number()), }), z.transform((v) => { @@ -800,38 +795,34 @@ export const BillingAttachRollover$outboundSchema: z.ZodMiniType< }), ); -export function billingAttachRolloverToJSON( - billingAttachRollover: BillingAttachRollover, -): string { - return JSON.stringify( - BillingAttachRollover$outboundSchema.parse(billingAttachRollover), - ); +export function attachRolloverToJSON(attachRollover: AttachRollover): string { + return JSON.stringify(AttachRollover$outboundSchema.parse(attachRollover)); } /** @internal */ -export type BillingAttachPlanItem$Outbound = { +export type AttachPlanItem$Outbound = { feature_id: string; included?: number | undefined; unlimited?: boolean | undefined; - reset?: BillingAttachReset$Outbound | undefined; - price?: BillingAttachPrice$Outbound | undefined; - proration?: BillingAttachProration$Outbound | undefined; - rollover?: BillingAttachRollover$Outbound | undefined; + reset?: AttachReset$Outbound | undefined; + price?: AttachPrice$Outbound | undefined; + proration?: AttachProration$Outbound | undefined; + rollover?: AttachRollover$Outbound | undefined; }; /** @internal */ -export const BillingAttachPlanItem$outboundSchema: z.ZodMiniType< - BillingAttachPlanItem$Outbound, - BillingAttachPlanItem +export const AttachPlanItem$outboundSchema: z.ZodMiniType< + AttachPlanItem$Outbound, + AttachPlanItem > = z.pipe( z.object({ featureId: z.string(), included: z.optional(z.number()), unlimited: z.optional(z.boolean()), - reset: z.optional(z.lazy(() => BillingAttachReset$outboundSchema)), - price: z.optional(z.lazy(() => BillingAttachPrice$outboundSchema)), - proration: z.optional(z.lazy(() => BillingAttachProration$outboundSchema)), - rollover: z.optional(z.lazy(() => BillingAttachRollover$outboundSchema)), + reset: z.optional(z.lazy(() => AttachReset$outboundSchema)), + price: z.optional(z.lazy(() => AttachPrice$outboundSchema)), + proration: z.optional(z.lazy(() => AttachProration$outboundSchema)), + rollover: z.optional(z.lazy(() => AttachRollover$outboundSchema)), }), z.transform((v) => { return remap$(v, { @@ -840,34 +831,30 @@ export const BillingAttachPlanItem$outboundSchema: z.ZodMiniType< }), ); -export function billingAttachPlanItemToJSON( - billingAttachPlanItem: BillingAttachPlanItem, -): string { - return JSON.stringify( - BillingAttachPlanItem$outboundSchema.parse(billingAttachPlanItem), - ); +export function attachPlanItemToJSON(attachPlanItem: AttachPlanItem): string { + return JSON.stringify(AttachPlanItem$outboundSchema.parse(attachPlanItem)); } /** @internal */ -export const BillingAttachDurationType$outboundSchema: z.ZodMiniEnum< - typeof BillingAttachDurationType -> = z.enum(BillingAttachDurationType); +export const AttachDurationType$outboundSchema: z.ZodMiniEnum< + typeof AttachDurationType +> = z.enum(AttachDurationType); /** @internal */ -export type BillingAttachFreeTrialParams$Outbound = { +export type AttachFreeTrialParams$Outbound = { duration_length: number; duration_type: string; card_required: boolean; }; /** @internal */ -export const BillingAttachFreeTrialParams$outboundSchema: z.ZodMiniType< - BillingAttachFreeTrialParams$Outbound, - BillingAttachFreeTrialParams +export const AttachFreeTrialParams$outboundSchema: z.ZodMiniType< + AttachFreeTrialParams$Outbound, + AttachFreeTrialParams > = z.pipe( z.object({ durationLength: z.number(), - durationType: z._default(BillingAttachDurationType$outboundSchema, "month"), + durationType: z._default(AttachDurationType$outboundSchema, "month"), cardRequired: z._default(z.boolean(), true), }), z.transform((v) => { @@ -879,37 +866,31 @@ export const BillingAttachFreeTrialParams$outboundSchema: z.ZodMiniType< }), ); -export function billingAttachFreeTrialParamsToJSON( - billingAttachFreeTrialParams: BillingAttachFreeTrialParams, +export function attachFreeTrialParamsToJSON( + attachFreeTrialParams: AttachFreeTrialParams, ): string { return JSON.stringify( - BillingAttachFreeTrialParams$outboundSchema.parse( - billingAttachFreeTrialParams, - ), + AttachFreeTrialParams$outboundSchema.parse(attachFreeTrialParams), ); } /** @internal */ -export type BillingAttachCustomize$Outbound = { - price?: BillingAttachBasePrice$Outbound | null | undefined; - items?: Array | undefined; - free_trial?: BillingAttachFreeTrialParams$Outbound | null | undefined; +export type AttachCustomize$Outbound = { + price?: AttachBasePrice$Outbound | null | undefined; + items?: Array | undefined; + free_trial?: AttachFreeTrialParams$Outbound | null | undefined; }; /** @internal */ -export const BillingAttachCustomize$outboundSchema: z.ZodMiniType< - BillingAttachCustomize$Outbound, - BillingAttachCustomize +export const AttachCustomize$outboundSchema: z.ZodMiniType< + AttachCustomize$Outbound, + AttachCustomize > = z.pipe( z.object({ - price: z.optional( - z.nullable(z.lazy(() => BillingAttachBasePrice$outboundSchema)), - ), - items: z.optional( - z.array(z.lazy(() => BillingAttachPlanItem$outboundSchema)), - ), + price: z.optional(z.nullable(z.lazy(() => AttachBasePrice$outboundSchema))), + items: z.optional(z.array(z.lazy(() => AttachPlanItem$outboundSchema))), freeTrial: z.optional( - z.nullable(z.lazy(() => BillingAttachFreeTrialParams$outboundSchema)), + z.nullable(z.lazy(() => AttachFreeTrialParams$outboundSchema)), ), }), z.transform((v) => { @@ -919,25 +900,23 @@ export const BillingAttachCustomize$outboundSchema: z.ZodMiniType< }), ); -export function billingAttachCustomizeToJSON( - billingAttachCustomize: BillingAttachCustomize, +export function attachCustomizeToJSON( + attachCustomize: AttachCustomize, ): string { - return JSON.stringify( - BillingAttachCustomize$outboundSchema.parse(billingAttachCustomize), - ); + return JSON.stringify(AttachCustomize$outboundSchema.parse(attachCustomize)); } /** @internal */ -export type BillingAttachInvoiceMode$Outbound = { +export type AttachInvoiceMode$Outbound = { enabled: boolean; enable_plan_immediately: boolean; finalize: boolean; }; /** @internal */ -export const BillingAttachInvoiceMode$outboundSchema: z.ZodMiniType< - BillingAttachInvoiceMode$Outbound, - BillingAttachInvoiceMode +export const AttachInvoiceMode$outboundSchema: z.ZodMiniType< + AttachInvoiceMode$Outbound, + AttachInvoiceMode > = z.pipe( z.object({ enabled: z.boolean(), @@ -951,29 +930,29 @@ export const BillingAttachInvoiceMode$outboundSchema: z.ZodMiniType< }), ); -export function billingAttachInvoiceModeToJSON( - billingAttachInvoiceMode: BillingAttachInvoiceMode, +export function attachInvoiceModeToJSON( + attachInvoiceMode: AttachInvoiceMode, ): string { return JSON.stringify( - BillingAttachInvoiceMode$outboundSchema.parse(billingAttachInvoiceMode), + AttachInvoiceMode$outboundSchema.parse(attachInvoiceMode), ); } /** @internal */ -export const BillingAttachProrationBehavior$outboundSchema: z.ZodMiniEnum< - typeof BillingAttachProrationBehavior -> = z.enum(BillingAttachProrationBehavior); +export const AttachProrationBehavior$outboundSchema: z.ZodMiniEnum< + typeof AttachProrationBehavior +> = z.enum(AttachProrationBehavior); /** @internal */ -export type BillingAttachAttachDiscount$Outbound = { +export type AttachAttachDiscount$Outbound = { reward_id?: string | undefined; promotion_code?: string | undefined; }; /** @internal */ -export const BillingAttachAttachDiscount$outboundSchema: z.ZodMiniType< - BillingAttachAttachDiscount$Outbound, - BillingAttachAttachDiscount +export const AttachAttachDiscount$outboundSchema: z.ZodMiniType< + AttachAttachDiscount$Outbound, + AttachAttachDiscount > = z.pipe( z.object({ rewardId: z.optional(z.string()), @@ -987,35 +966,34 @@ export const BillingAttachAttachDiscount$outboundSchema: z.ZodMiniType< }), ); -export function billingAttachAttachDiscountToJSON( - billingAttachAttachDiscount: BillingAttachAttachDiscount, +export function attachAttachDiscountToJSON( + attachAttachDiscount: AttachAttachDiscount, ): string { return JSON.stringify( - BillingAttachAttachDiscount$outboundSchema.parse( - billingAttachAttachDiscount, - ), + AttachAttachDiscount$outboundSchema.parse(attachAttachDiscount), ); } /** @internal */ -export const BillingAttachPlanSchedule$outboundSchema: z.ZodMiniEnum< - typeof BillingAttachPlanSchedule -> = z.enum(BillingAttachPlanSchedule); +export const AttachPlanSchedule$outboundSchema: z.ZodMiniEnum< + typeof AttachPlanSchedule +> = z.enum(AttachPlanSchedule); /** @internal */ export type AttachParams$Outbound = { customer_id: string; entity_id?: string | undefined; plan_id: string; - feature_quantities?: Array | undefined; + feature_quantities?: Array | undefined; version?: number | undefined; - customize?: BillingAttachCustomize$Outbound | undefined; - invoice_mode?: BillingAttachInvoiceMode$Outbound | undefined; + customize?: AttachCustomize$Outbound | undefined; + invoice_mode?: AttachInvoiceMode$Outbound | undefined; proration_behavior?: string | undefined; - discounts?: Array | undefined; + discounts?: Array | undefined; success_url?: string | undefined; new_billing_subscription?: boolean | undefined; plan_schedule?: string | undefined; + checkout_session_params?: { [k: string]: any } | undefined; }; /** @internal */ @@ -1028,22 +1006,19 @@ export const AttachParams$outboundSchema: z.ZodMiniType< entityId: z.optional(z.string()), planId: z.string(), featureQuantities: z.optional( - z.array(z.lazy(() => BillingAttachFeatureQuantity$outboundSchema)), + z.array(z.lazy(() => AttachFeatureQuantity$outboundSchema)), ), version: z.optional(z.number()), - customize: z.optional(z.lazy(() => BillingAttachCustomize$outboundSchema)), - invoiceMode: z.optional( - z.lazy(() => BillingAttachInvoiceMode$outboundSchema), - ), - prorationBehavior: z.optional( - BillingAttachProrationBehavior$outboundSchema, - ), + customize: z.optional(z.lazy(() => AttachCustomize$outboundSchema)), + invoiceMode: z.optional(z.lazy(() => AttachInvoiceMode$outboundSchema)), + prorationBehavior: z.optional(AttachProrationBehavior$outboundSchema), discounts: z.optional( - z.array(z.lazy(() => BillingAttachAttachDiscount$outboundSchema)), + z.array(z.lazy(() => AttachAttachDiscount$outboundSchema)), ), successUrl: z.optional(z.string()), newBillingSubscription: z.optional(z.boolean()), - planSchedule: z.optional(BillingAttachPlanSchedule$outboundSchema), + planSchedule: z.optional(AttachPlanSchedule$outboundSchema), + checkoutSessionParams: z.optional(z.record(z.string(), z.any())), }), z.transform((v) => { return remap$(v, { @@ -1056,6 +1031,7 @@ export const AttachParams$outboundSchema: z.ZodMiniType< successUrl: "success_url", newBillingSubscription: "new_billing_subscription", planSchedule: "plan_schedule", + checkoutSessionParams: "checkout_session_params", }); }), ); @@ -1065,8 +1041,8 @@ export function attachParamsToJSON(attachParams: AttachParams): string { } /** @internal */ -export const BillingAttachInvoice$inboundSchema: z.ZodMiniType< - BillingAttachInvoice, +export const AttachInvoice$inboundSchema: z.ZodMiniType< + AttachInvoice, unknown > = z.pipe( z.object({ @@ -1084,53 +1060,51 @@ export const BillingAttachInvoice$inboundSchema: z.ZodMiniType< }), ); -export function billingAttachInvoiceFromJSON( +export function attachInvoiceFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BillingAttachInvoice$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingAttachInvoice' from JSON`, + (x) => AttachInvoice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AttachInvoice' from JSON`, ); } /** @internal */ -export const BillingAttachCode$inboundSchema: z.ZodMiniType< - BillingAttachCode, - unknown -> = openEnums.inboundSchema(BillingAttachCode); +export const AttachCode$inboundSchema: z.ZodMiniType = + openEnums.inboundSchema(AttachCode); /** @internal */ -export const BillingAttachRequiredAction$inboundSchema: z.ZodMiniType< - BillingAttachRequiredAction, +export const AttachRequiredAction$inboundSchema: z.ZodMiniType< + AttachRequiredAction, unknown > = z.object({ - code: BillingAttachCode$inboundSchema, + code: AttachCode$inboundSchema, reason: types.string(), }); -export function billingAttachRequiredActionFromJSON( +export function attachRequiredActionFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BillingAttachRequiredAction$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingAttachRequiredAction' from JSON`, + (x) => AttachRequiredAction$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AttachRequiredAction' from JSON`, ); } /** @internal */ -export const BillingAttachResponse$inboundSchema: z.ZodMiniType< - BillingAttachResponse, +export const AttachResponse$inboundSchema: z.ZodMiniType< + AttachResponse, unknown > = z.pipe( z.object({ customer_id: types.string(), entity_id: types.optional(types.string()), - invoice: types.optional(z.lazy(() => BillingAttachInvoice$inboundSchema)), + invoice: types.optional(z.lazy(() => AttachInvoice$inboundSchema)), payment_url: types.nullable(types.string()), required_action: types.optional( - z.lazy(() => BillingAttachRequiredAction$inboundSchema), + z.lazy(() => AttachRequiredAction$inboundSchema), ), }), z.transform((v) => { @@ -1143,12 +1117,12 @@ export const BillingAttachResponse$inboundSchema: z.ZodMiniType< }), ); -export function billingAttachResponseFromJSON( +export function attachResponseFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BillingAttachResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingAttachResponse' from JSON`, + (x) => AttachResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AttachResponse' from JSON`, ); } diff --git a/packages/sdk/src/models/balance.ts b/packages/sdk/src/models/balance.ts index b378971b3..b0f1fe067 100644 --- a/packages/sdk/src/models/balance.ts +++ b/packages/sdk/src/models/balance.ts @@ -126,8 +126,21 @@ export type BalanceTo = number | string; export type BalanceTier = { to: number | string; amount: number; + flatAmount?: number | null | undefined; }; +/** + * How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). + */ +export const BalanceTierBehavior = { + Graduated: "graduated", + Volume: "volume", +} as const; +/** + * How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). + */ +export type BalanceTierBehavior = OpenEnum; + /** * Whether usage is prepaid or billed pay-per-use. */ @@ -149,6 +162,10 @@ export type BalancePrice = { * Tiered pricing configuration if applicable. */ tiers?: Array | undefined; + /** + * How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). + */ + tierBehavior?: BalanceTierBehavior | undefined; /** * The number of units per billing increment (eg. $9 / 250 units). */ @@ -411,10 +428,18 @@ export function balanceToFromJSON( /** @internal */ export const BalanceTier$inboundSchema: z.ZodMiniType = z - .object({ - to: smartUnion([types.number(), types.string()]), - amount: types.number(), - }); + .pipe( + z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), + flat_amount: z.optional(z.nullable(types.number())), + }), + z.transform((v) => { + return remap$(v, { + "flat_amount": "flatAmount", + }); + }), + ); export function balanceTierFromJSON( jsonString: string, @@ -426,6 +451,12 @@ export function balanceTierFromJSON( ); } +/** @internal */ +export const BalanceTierBehavior$inboundSchema: z.ZodMiniType< + BalanceTierBehavior, + unknown +> = openEnums.inboundSchema(BalanceTierBehavior); + /** @internal */ export const BalanceBillingMethod$inboundSchema: z.ZodMiniType< BalanceBillingMethod, @@ -438,12 +469,14 @@ export const BalancePrice$inboundSchema: z.ZodMiniType = z.object({ amount: types.optional(types.number()), tiers: types.optional(z.array(z.lazy(() => BalanceTier$inboundSchema))), + tier_behavior: types.optional(BalanceTierBehavior$inboundSchema), billing_units: types.number(), billing_method: BalanceBillingMethod$inboundSchema, max_purchase: types.nullable(types.number()), }), z.transform((v) => { return remap$(v, { + "tier_behavior": "tierBehavior", "billing_units": "billingUnits", "billing_method": "billingMethod", "max_purchase": "maxPurchase", diff --git a/packages/sdk/src/models/billing-update-op.ts b/packages/sdk/src/models/billing-update-op.ts index 4760caf90..5ece9ccdc 100644 --- a/packages/sdk/src/models/billing-update-op.ts +++ b/packages/sdk/src/models/billing-update-op.ts @@ -110,8 +110,17 @@ export type BillingUpdateTo = number | string; export type BillingUpdateTier = { to: number | string; amount: number; + flatAmount?: number | null | undefined; }; +export const BillingUpdateTierBehavior = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type BillingUpdateTierBehavior = ClosedEnum< + typeof BillingUpdateTierBehavior +>; + /** * Billing interval. For consumable features, should match reset.interval. */ @@ -153,9 +162,10 @@ export type BillingUpdatePrice = { */ amount?: number | undefined; /** - * Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + * Tiered pricing. Either 'amount' or 'tiers' is required. */ tiers?: Array | undefined; + tierBehavior?: BillingUpdateTierBehavior | undefined; /** * Billing interval. For consumable features, should match reset.interval. */ @@ -632,16 +642,25 @@ export function billingUpdateToToJSON( export type BillingUpdateTier$Outbound = { to: number | string; amount: number; + flat_amount?: number | null | undefined; }; /** @internal */ export const BillingUpdateTier$outboundSchema: z.ZodMiniType< BillingUpdateTier$Outbound, BillingUpdateTier -> = z.object({ - to: smartUnion([z.number(), z.string()]), - amount: z.number(), -}); +> = z.pipe( + z.object({ + to: smartUnion([z.number(), z.string()]), + amount: z.number(), + flatAmount: z.optional(z.nullable(z.number())), + }), + z.transform((v) => { + return remap$(v, { + flatAmount: "flat_amount", + }); + }), +); export function billingUpdateTierToJSON( billingUpdateTier: BillingUpdateTier, @@ -651,6 +670,11 @@ export function billingUpdateTierToJSON( ); } +/** @internal */ +export const BillingUpdateTierBehavior$outboundSchema: z.ZodMiniEnum< + typeof BillingUpdateTierBehavior +> = z.enum(BillingUpdateTierBehavior); + /** @internal */ export const BillingUpdateItemPriceInterval$outboundSchema: z.ZodMiniEnum< typeof BillingUpdateItemPriceInterval @@ -665,6 +689,7 @@ export const BillingUpdateBillingMethod$outboundSchema: z.ZodMiniEnum< export type BillingUpdatePrice$Outbound = { amount?: number | undefined; tiers?: Array | undefined; + tier_behavior?: string | undefined; interval: string; interval_count: number; billing_units: number; @@ -680,6 +705,7 @@ export const BillingUpdatePrice$outboundSchema: z.ZodMiniType< z.object({ amount: z.optional(z.number()), tiers: z.optional(z.array(z.lazy(() => BillingUpdateTier$outboundSchema))), + tierBehavior: z.optional(BillingUpdateTierBehavior$outboundSchema), interval: BillingUpdateItemPriceInterval$outboundSchema, intervalCount: z._default(z.number(), 1), billingUnits: z._default(z.number(), 1), @@ -688,6 +714,7 @@ export const BillingUpdatePrice$outboundSchema: z.ZodMiniType< }), z.transform((v) => { return remap$(v, { + tierBehavior: "tier_behavior", intervalCount: "interval_count", billingUnits: "billing_units", billingMethod: "billing_method", diff --git a/packages/sdk/src/models/check-op.ts b/packages/sdk/src/models/check-op.ts index 87c347986..b4674590b 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 Scenario = { +export const CheckScenario = { 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 Scenario = OpenEnum; +export type CheckScenario = OpenEnum; /** * The environment of the product @@ -115,8 +115,18 @@ export type Tiers = { * The price of the product item for this tier. */ amount: number; + /** + * A flat fee charged for this tier, in addition to the per-unit amount. + */ + flatAmount?: number | null | undefined; }; +export const CheckTierBehavior = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type CheckTierBehavior = OpenEnum; + export const UsageModel = { Prepaid: "prepaid", PayPerUse: "pay_per_use", @@ -199,6 +209,10 @@ export type CheckItem = { * Tiered pricing for the product item. Not applicable for fixed price items. */ tiers?: Array | null | undefined; + /** + * How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). Defaults to graduated. + */ + tierBehavior?: CheckTierBehavior | null | undefined; /** * Whether the feature should be prepaid upfront or billed for how much they use end of billing period. */ @@ -374,7 +388,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: Scenario; + scenario: CheckScenario; /** * A title suitable for displaying in a paywall or upgrade modal. */ @@ -469,8 +483,10 @@ export function checkParamsToJSON(checkParams: CheckParams): string { } /** @internal */ -export const Scenario$inboundSchema: z.ZodMiniType = - openEnums.inboundSchema(Scenario); +export const CheckScenario$inboundSchema: z.ZodMiniType< + CheckScenario, + unknown +> = openEnums.inboundSchema(CheckScenario); /** @internal */ export const CheckEnv$inboundSchema: z.ZodMiniType = @@ -521,10 +537,18 @@ export function checkToFromJSON( } /** @internal */ -export const Tiers$inboundSchema: z.ZodMiniType = z.object({ - to: smartUnion([types.number(), types.string()]), - amount: types.number(), -}); +export const Tiers$inboundSchema: z.ZodMiniType = z.pipe( + z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), + flat_amount: z.optional(z.nullable(types.number())), + }), + z.transform((v) => { + return remap$(v, { + "flat_amount": "flatAmount", + }); + }), +); export function tiersFromJSON( jsonString: string, @@ -536,6 +560,12 @@ export function tiersFromJSON( ); } +/** @internal */ +export const CheckTierBehavior$inboundSchema: z.ZodMiniType< + CheckTierBehavior, + unknown +> = openEnums.inboundSchema(CheckTierBehavior); + /** @internal */ export const UsageModel$inboundSchema: z.ZodMiniType = openEnums.inboundSchema(UsageModel); @@ -642,6 +672,7 @@ export const CheckItem$inboundSchema: z.ZodMiniType = z interval_count: z.optional(z.nullable(types.number())), price: z.optional(z.nullable(types.number())), tiers: z.optional(z.nullable(z.array(z.lazy(() => Tiers$inboundSchema)))), + tier_behavior: z.optional(z.nullable(CheckTierBehavior$inboundSchema)), usage_model: z.optional(z.nullable(UsageModel$inboundSchema)), billing_units: z.optional(z.nullable(types.number())), reset_usage_when_enabled: z.optional(z.nullable(types.boolean())), @@ -657,6 +688,7 @@ export const CheckItem$inboundSchema: z.ZodMiniType = z "feature_type": "featureType", "included_usage": "includedUsage", "interval_count": "intervalCount", + "tier_behavior": "tierBehavior", "usage_model": "usageModel", "billing_units": "billingUnits", "reset_usage_when_enabled": "resetUsageWhenEnabled", @@ -793,7 +825,7 @@ export function productFromJSON( /** @internal */ export const Preview$inboundSchema: z.ZodMiniType = z.pipe( z.object({ - scenario: Scenario$inboundSchema, + scenario: CheckScenario$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 index 2dadbeda0..d7f3ac392 100644 --- a/packages/sdk/src/models/create-plan-op.ts +++ b/packages/sdk/src/models/create-plan-op.ts @@ -92,8 +92,17 @@ export type CreatePlanToRequest = number | string; export type CreatePlanTierRequest = { to: number | string; amount: number; + flatAmount?: number | null | undefined; }; +export const CreatePlanTierBehaviorRequest = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type CreatePlanTierBehaviorRequest = ClosedEnum< + typeof CreatePlanTierBehaviorRequest +>; + /** * Billing interval. For consumable features, should match reset.interval. */ @@ -135,9 +144,10 @@ export type CreatePlanItemPriceRequest = { */ amount?: number | undefined; /** - * Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + * Tiered pricing. Either 'amount' or 'tiers' is required. */ tiers?: Array | undefined; + tierBehavior?: CreatePlanTierBehaviorRequest | undefined; /** * Billing interval. For consumable features, should match reset.interval. */ @@ -496,8 +506,17 @@ export type CreatePlanToResponse = number | string; export type CreatePlanTierResponse = { to: number | string; amount: number; + flatAmount?: number | null | undefined; }; +export const CreatePlanTierBehaviorResponse = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type CreatePlanTierBehaviorResponse = OpenEnum< + typeof CreatePlanTierBehaviorResponse +>; + /** * Billing interval for this price. For consumable features, should match reset.interval. */ @@ -536,9 +555,10 @@ export type CreatePlanItemPriceResponse = { */ amount?: number | undefined; /** - * Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + * Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. */ tiers?: Array | undefined; + tierBehavior?: CreatePlanTierBehaviorResponse | undefined; /** * Billing interval for this price. For consumable features, should match reset.interval. */ @@ -687,6 +707,36 @@ export const CreatePlanEnv = { */ export type CreatePlanEnv = OpenEnum; +/** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ +export const CreatePlanScenario = { + Scheduled: "scheduled", + Active: "active", + New: "new", + Renew: "renew", + Upgrade: "upgrade", + Downgrade: "downgrade", + Cancel: "cancel", + Expired: "expired", + PastDue: "past_due", +} as const; +/** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ +export type CreatePlanScenario = OpenEnum; + +export type CreatePlanCustomerEligibility = { + /** + * Whether a free trial is available for this customer. + */ + trialAvailable?: boolean | undefined; + /** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ + scenario: CreatePlanScenario; +}; + /** * A plan defines a set of features, pricing, and entitlements that can be attached to customers. */ @@ -747,6 +797,7 @@ export type CreatePlanResponse = { * If this is a variant, the ID of the base plan it was created from. */ baseVariantId: string | null; + customerEligibility?: CreatePlanCustomerEligibility | undefined; }; /** @internal */ @@ -842,16 +893,25 @@ export function createPlanToRequestToJSON( export type CreatePlanTierRequest$Outbound = { to: number | string; amount: number; + flat_amount?: number | null | undefined; }; /** @internal */ export const CreatePlanTierRequest$outboundSchema: z.ZodMiniType< CreatePlanTierRequest$Outbound, CreatePlanTierRequest -> = z.object({ - to: smartUnion([z.number(), z.string()]), - amount: z.number(), -}); +> = z.pipe( + z.object({ + to: smartUnion([z.number(), z.string()]), + amount: z.number(), + flatAmount: z.optional(z.nullable(z.number())), + }), + z.transform((v) => { + return remap$(v, { + flatAmount: "flat_amount", + }); + }), +); export function createPlanTierRequestToJSON( createPlanTierRequest: CreatePlanTierRequest, @@ -861,6 +921,11 @@ export function createPlanTierRequestToJSON( ); } +/** @internal */ +export const CreatePlanTierBehaviorRequest$outboundSchema: z.ZodMiniEnum< + typeof CreatePlanTierBehaviorRequest +> = z.enum(CreatePlanTierBehaviorRequest); + /** @internal */ export const CreatePlanItemPriceIntervalRequest$outboundSchema: z.ZodMiniEnum< typeof CreatePlanItemPriceIntervalRequest @@ -875,6 +940,7 @@ export const CreatePlanBillingMethodRequest$outboundSchema: z.ZodMiniEnum< export type CreatePlanItemPriceRequest$Outbound = { amount?: number | undefined; tiers?: Array | undefined; + tier_behavior?: string | undefined; interval: string; interval_count: number; billing_units: number; @@ -892,6 +958,7 @@ export const CreatePlanItemPriceRequest$outboundSchema: z.ZodMiniType< tiers: z.optional( z.array(z.lazy(() => CreatePlanTierRequest$outboundSchema)), ), + tierBehavior: z.optional(CreatePlanTierBehaviorRequest$outboundSchema), interval: CreatePlanItemPriceIntervalRequest$outboundSchema, intervalCount: z._default(z.number(), 1), billingUnits: z._default(z.number(), 1), @@ -900,6 +967,7 @@ export const CreatePlanItemPriceRequest$outboundSchema: z.ZodMiniType< }), z.transform((v) => { return remap$(v, { + tierBehavior: "tier_behavior", intervalCount: "interval_count", billingUnits: "billing_units", billingMethod: "billing_method", @@ -1325,10 +1393,18 @@ export function createPlanToResponseFromJSON( export const CreatePlanTierResponse$inboundSchema: z.ZodMiniType< CreatePlanTierResponse, unknown -> = z.object({ - to: smartUnion([types.number(), types.string()]), - amount: types.number(), -}); +> = z.pipe( + z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), + flat_amount: z.optional(z.nullable(types.number())), + }), + z.transform((v) => { + return remap$(v, { + "flat_amount": "flatAmount", + }); + }), +); export function createPlanTierResponseFromJSON( jsonString: string, @@ -1340,6 +1416,12 @@ export function createPlanTierResponseFromJSON( ); } +/** @internal */ +export const CreatePlanTierBehaviorResponse$inboundSchema: z.ZodMiniType< + CreatePlanTierBehaviorResponse, + unknown +> = openEnums.inboundSchema(CreatePlanTierBehaviorResponse); + /** @internal */ export const CreatePlanPriceItemIntervalResponse$inboundSchema: z.ZodMiniType< CreatePlanPriceItemIntervalResponse, @@ -1362,6 +1444,7 @@ export const CreatePlanItemPriceResponse$inboundSchema: z.ZodMiniType< tiers: types.optional( z.array(z.lazy(() => CreatePlanTierResponse$inboundSchema)), ), + tier_behavior: types.optional(CreatePlanTierBehaviorResponse$inboundSchema), interval: CreatePlanPriceItemIntervalResponse$inboundSchema, interval_count: types.optional(types.number()), billing_units: types.number(), @@ -1370,6 +1453,7 @@ export const CreatePlanItemPriceResponse$inboundSchema: z.ZodMiniType< }), z.transform((v) => { return remap$(v, { + "tier_behavior": "tierBehavior", "interval_count": "intervalCount", "billing_units": "billingUnits", "billing_method": "billingMethod", @@ -1526,6 +1610,38 @@ export const CreatePlanEnv$inboundSchema: z.ZodMiniType< unknown > = openEnums.inboundSchema(CreatePlanEnv); +/** @internal */ +export const CreatePlanScenario$inboundSchema: z.ZodMiniType< + CreatePlanScenario, + unknown +> = openEnums.inboundSchema(CreatePlanScenario); + +/** @internal */ +export const CreatePlanCustomerEligibility$inboundSchema: z.ZodMiniType< + CreatePlanCustomerEligibility, + unknown +> = z.pipe( + z.object({ + trial_available: types.optional(types.boolean()), + scenario: CreatePlanScenario$inboundSchema, + }), + z.transform((v) => { + return remap$(v, { + "trial_available": "trialAvailable", + }); + }), +); + +export function createPlanCustomerEligibilityFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePlanCustomerEligibility$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePlanCustomerEligibility' from JSON`, + ); +} + /** @internal */ export const CreatePlanResponse$inboundSchema: z.ZodMiniType< CreatePlanResponse, @@ -1548,6 +1664,9 @@ export const CreatePlanResponse$inboundSchema: z.ZodMiniType< env: CreatePlanEnv$inboundSchema, archived: types.boolean(), base_variant_id: types.nullable(types.string()), + customer_eligibility: types.optional( + z.lazy(() => CreatePlanCustomerEligibility$inboundSchema), + ), }), z.transform((v) => { return remap$(v, { @@ -1556,6 +1675,7 @@ export const CreatePlanResponse$inboundSchema: z.ZodMiniType< "free_trial": "freeTrial", "created_at": "createdAt", "base_variant_id": "baseVariantId", + "customer_eligibility": "customerEligibility", }); }), ); diff --git a/packages/sdk/src/models/get-plan-op.ts b/packages/sdk/src/models/get-plan-op.ts index 7379a7233..83cf86117 100644 --- a/packages/sdk/src/models/get-plan-op.ts +++ b/packages/sdk/src/models/get-plan-op.ts @@ -178,8 +178,15 @@ export type GetPlanTo = number | string; export type GetPlanTier = { to: number | string; amount: number; + flatAmount?: number | null | undefined; }; +export const GetPlanTierBehavior = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type GetPlanTierBehavior = OpenEnum; + /** * Billing interval for this price. For consumable features, should match reset.interval. */ @@ -216,9 +223,10 @@ export type GetPlanItemPrice = { */ amount?: number | undefined; /** - * Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + * Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. */ tiers?: Array | undefined; + tierBehavior?: GetPlanTierBehavior | undefined; /** * Billing interval for this price. For consumable features, should match reset.interval. */ @@ -365,6 +373,36 @@ export const GetPlanEnv = { */ export type GetPlanEnv = OpenEnum; +/** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ +export const GetPlanScenario = { + Scheduled: "scheduled", + Active: "active", + New: "new", + Renew: "renew", + Upgrade: "upgrade", + Downgrade: "downgrade", + Cancel: "cancel", + Expired: "expired", + PastDue: "past_due", +} as const; +/** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ +export type GetPlanScenario = OpenEnum; + +export type GetPlanCustomerEligibility = { + /** + * Whether a free trial is available for this customer. + */ + trialAvailable?: boolean | undefined; + /** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ + scenario: GetPlanScenario; +}; + /** * A plan defines a set of features, pricing, and entitlements that can be attached to customers. */ @@ -425,6 +463,7 @@ export type GetPlanResponse = { * If this is a variant, the ID of the base plan it was created from. */ baseVariantId: string | null; + customerEligibility?: GetPlanCustomerEligibility | undefined; }; /** @internal */ @@ -642,10 +681,18 @@ export function getPlanToFromJSON( /** @internal */ export const GetPlanTier$inboundSchema: z.ZodMiniType = z - .object({ - to: smartUnion([types.number(), types.string()]), - amount: types.number(), - }); + .pipe( + z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), + flat_amount: z.optional(z.nullable(types.number())), + }), + z.transform((v) => { + return remap$(v, { + "flat_amount": "flatAmount", + }); + }), + ); export function getPlanTierFromJSON( jsonString: string, @@ -657,6 +704,12 @@ export function getPlanTierFromJSON( ); } +/** @internal */ +export const GetPlanTierBehavior$inboundSchema: z.ZodMiniType< + GetPlanTierBehavior, + unknown +> = openEnums.inboundSchema(GetPlanTierBehavior); + /** @internal */ export const GetPlanPriceItemInterval$inboundSchema: z.ZodMiniType< GetPlanPriceItemInterval, @@ -677,6 +730,7 @@ export const GetPlanItemPrice$inboundSchema: z.ZodMiniType< z.object({ amount: types.optional(types.number()), tiers: types.optional(z.array(z.lazy(() => GetPlanTier$inboundSchema))), + tier_behavior: types.optional(GetPlanTierBehavior$inboundSchema), interval: GetPlanPriceItemInterval$inboundSchema, interval_count: types.optional(types.number()), billing_units: types.number(), @@ -685,6 +739,7 @@ export const GetPlanItemPrice$inboundSchema: z.ZodMiniType< }), z.transform((v) => { return remap$(v, { + "tier_behavior": "tierBehavior", "interval_count": "intervalCount", "billing_units": "billingUnits", "billing_method": "billingMethod", @@ -833,6 +888,38 @@ export function getPlanFreeTrialFromJSON( export const GetPlanEnv$inboundSchema: z.ZodMiniType = openEnums.inboundSchema(GetPlanEnv); +/** @internal */ +export const GetPlanScenario$inboundSchema: z.ZodMiniType< + GetPlanScenario, + unknown +> = openEnums.inboundSchema(GetPlanScenario); + +/** @internal */ +export const GetPlanCustomerEligibility$inboundSchema: z.ZodMiniType< + GetPlanCustomerEligibility, + unknown +> = z.pipe( + z.object({ + trial_available: types.optional(types.boolean()), + scenario: GetPlanScenario$inboundSchema, + }), + z.transform((v) => { + return remap$(v, { + "trial_available": "trialAvailable", + }); + }), +); + +export function getPlanCustomerEligibilityFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetPlanCustomerEligibility$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetPlanCustomerEligibility' from JSON`, + ); +} + /** @internal */ export const GetPlanResponse$inboundSchema: z.ZodMiniType< GetPlanResponse, @@ -853,6 +940,9 @@ export const GetPlanResponse$inboundSchema: z.ZodMiniType< env: GetPlanEnv$inboundSchema, archived: types.boolean(), base_variant_id: types.nullable(types.string()), + customer_eligibility: types.optional( + z.lazy(() => GetPlanCustomerEligibility$inboundSchema), + ), }), z.transform((v) => { return remap$(v, { @@ -861,6 +951,7 @@ export const GetPlanResponse$inboundSchema: z.ZodMiniType< "free_trial": "freeTrial", "created_at": "createdAt", "base_variant_id": "baseVariantId", + "customer_eligibility": "customerEligibility", }); }), ); diff --git a/packages/sdk/src/models/index.ts b/packages/sdk/src/models/index.ts index bf70667b0..d2d9acb1c 100644 --- a/packages/sdk/src/models/index.ts +++ b/packages/sdk/src/models/index.ts @@ -3,10 +3,10 @@ */ export * from "./aggregate-events-op.js"; +export * from "./attach-op.js"; export * from "./autumn-default-error.js"; export * from "./autumn-error.js"; export * from "./balance.js"; -export * from "./billing-attach-op.js"; export * from "./billing-update-op.js"; export * from "./check-op.js"; export * from "./create-balance-op.js"; @@ -30,9 +30,11 @@ export * from "./list-customers-op.js"; export * from "./list-events-op.js"; export * from "./list-features-op.js"; export * from "./list-plans-op.js"; +export * from "./multi-attach-op.js"; export * from "./open-customer-portal-op.js"; export * from "./plan.js"; export * from "./preview-attach-op.js"; +export * from "./preview-multi-attach-op.js"; export * from "./preview-update-op.js"; export * from "./redeem-referral-code-op.js"; export * from "./response-validation-error.js"; diff --git a/packages/sdk/src/models/list-plans-op.ts b/packages/sdk/src/models/list-plans-op.ts index 7d208a676..bd4fbef18 100644 --- a/packages/sdk/src/models/list-plans-op.ts +++ b/packages/sdk/src/models/list-plans-op.ts @@ -182,8 +182,15 @@ export type ListPlansTo = number | string; export type ListPlansTier = { to: number | string; amount: number; + flatAmount?: number | null | undefined; }; +export const ListPlansTierBehavior = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type ListPlansTierBehavior = OpenEnum; + /** * Billing interval for this price. For consumable features, should match reset.interval. */ @@ -220,9 +227,10 @@ export type ListPlansItemPrice = { */ amount?: number | undefined; /** - * Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + * Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. */ tiers?: Array | undefined; + tierBehavior?: ListPlansTierBehavior | undefined; /** * Billing interval for this price. For consumable features, should match reset.interval. */ @@ -369,6 +377,36 @@ export const ListPlansEnv = { */ export type ListPlansEnv = OpenEnum; +/** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ +export const ListPlansScenario = { + Scheduled: "scheduled", + Active: "active", + New: "new", + Renew: "renew", + Upgrade: "upgrade", + Downgrade: "downgrade", + Cancel: "cancel", + Expired: "expired", + PastDue: "past_due", +} as const; +/** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ +export type ListPlansScenario = OpenEnum; + +export type ListPlansCustomerEligibility = { + /** + * Whether a free trial is available for this customer. + */ + trialAvailable?: boolean | undefined; + /** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ + scenario: ListPlansScenario; +}; + /** * A plan defines a set of features, pricing, and entitlements that can be attached to customers. */ @@ -429,6 +467,7 @@ export type ListPlansList = { * If this is a variant, the ID of the base plan it was created from. */ baseVariantId: string | null; + customerEligibility?: ListPlansCustomerEligibility | undefined; }; /** @@ -667,10 +706,18 @@ export function listPlansToFromJSON( export const ListPlansTier$inboundSchema: z.ZodMiniType< ListPlansTier, unknown -> = z.object({ - to: smartUnion([types.number(), types.string()]), - amount: types.number(), -}); +> = z.pipe( + z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), + flat_amount: z.optional(z.nullable(types.number())), + }), + z.transform((v) => { + return remap$(v, { + "flat_amount": "flatAmount", + }); + }), +); export function listPlansTierFromJSON( jsonString: string, @@ -682,6 +729,12 @@ export function listPlansTierFromJSON( ); } +/** @internal */ +export const ListPlansTierBehavior$inboundSchema: z.ZodMiniType< + ListPlansTierBehavior, + unknown +> = openEnums.inboundSchema(ListPlansTierBehavior); + /** @internal */ export const ListPlansPriceItemInterval$inboundSchema: z.ZodMiniType< ListPlansPriceItemInterval, @@ -702,6 +755,7 @@ export const ListPlansItemPrice$inboundSchema: z.ZodMiniType< z.object({ amount: types.optional(types.number()), tiers: types.optional(z.array(z.lazy(() => ListPlansTier$inboundSchema))), + tier_behavior: types.optional(ListPlansTierBehavior$inboundSchema), interval: ListPlansPriceItemInterval$inboundSchema, interval_count: types.optional(types.number()), billing_units: types.number(), @@ -710,6 +764,7 @@ export const ListPlansItemPrice$inboundSchema: z.ZodMiniType< }), z.transform((v) => { return remap$(v, { + "tier_behavior": "tierBehavior", "interval_count": "intervalCount", "billing_units": "billingUnits", "billing_method": "billingMethod", @@ -860,6 +915,38 @@ export function listPlansFreeTrialFromJSON( export const ListPlansEnv$inboundSchema: z.ZodMiniType = openEnums.inboundSchema(ListPlansEnv); +/** @internal */ +export const ListPlansScenario$inboundSchema: z.ZodMiniType< + ListPlansScenario, + unknown +> = openEnums.inboundSchema(ListPlansScenario); + +/** @internal */ +export const ListPlansCustomerEligibility$inboundSchema: z.ZodMiniType< + ListPlansCustomerEligibility, + unknown +> = z.pipe( + z.object({ + trial_available: types.optional(types.boolean()), + scenario: ListPlansScenario$inboundSchema, + }), + z.transform((v) => { + return remap$(v, { + "trial_available": "trialAvailable", + }); + }), +); + +export function listPlansCustomerEligibilityFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListPlansCustomerEligibility$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListPlansCustomerEligibility' from JSON`, + ); +} + /** @internal */ export const ListPlansList$inboundSchema: z.ZodMiniType< ListPlansList, @@ -880,6 +967,9 @@ export const ListPlansList$inboundSchema: z.ZodMiniType< env: ListPlansEnv$inboundSchema, archived: types.boolean(), base_variant_id: types.nullable(types.string()), + customer_eligibility: types.optional( + z.lazy(() => ListPlansCustomerEligibility$inboundSchema), + ), }), z.transform((v) => { return remap$(v, { @@ -888,6 +978,7 @@ export const ListPlansList$inboundSchema: z.ZodMiniType< "free_trial": "freeTrial", "created_at": "createdAt", "base_variant_id": "baseVariantId", + "customer_eligibility": "customerEligibility", }); }), ); diff --git a/packages/sdk/src/models/multi-attach-op.ts b/packages/sdk/src/models/multi-attach-op.ts new file mode 100644 index 000000000..6488b19c7 --- /dev/null +++ b/packages/sdk/src/models/multi-attach-op.ts @@ -0,0 +1,1235 @@ +/* + * 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 { + CustomerData, + CustomerData$Outbound, + CustomerData$outboundSchema, +} from "./customer-data.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type MultiAttachGlobals = { + xApiVersion?: string | undefined; +}; + +/** + * Billing interval (e.g. 'month', 'year'). + */ +export const MultiAttachPriceInterval = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ +export type MultiAttachPriceInterval = ClosedEnum< + typeof MultiAttachPriceInterval +>; + +/** + * Base price configuration for a plan. + */ +export type MultiAttachBasePrice = { + /** + * Base price amount for the plan. + */ + amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ + interval: MultiAttachPriceInterval; + /** + * 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 MultiAttachResetInterval = { + 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 MultiAttachResetInterval = ClosedEnum< + typeof MultiAttachResetInterval +>; + +/** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ +export type MultiAttachReset = { + /** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ + interval: MultiAttachResetInterval; + /** + * Number of intervals between resets. Defaults to 1. + */ + intervalCount?: number | undefined; +}; + +export type MultiAttachTo = number | string; + +export type MultiAttachTier = { + to: number | string; + amount: number; + flatAmount?: number | null | undefined; +}; + +export const MultiAttachTierBehavior = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type MultiAttachTierBehavior = ClosedEnum< + typeof MultiAttachTierBehavior +>; + +/** + * Billing interval. For consumable features, should match reset.interval. + */ +export const MultiAttachItemPriceInterval = { + 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 MultiAttachItemPriceInterval = ClosedEnum< + typeof MultiAttachItemPriceInterval +>; + +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ +export const MultiAttachBillingMethod = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ +export type MultiAttachBillingMethod = ClosedEnum< + typeof MultiAttachBillingMethod +>; + +/** + * Pricing for usage beyond included units. Omit for free features. + */ +export type MultiAttachPrice = { + /** + * Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + */ + amount?: number | undefined; + /** + * Tiered pricing. Either 'amount' or 'tiers' is required. + */ + tiers?: Array | undefined; + tierBehavior?: MultiAttachTierBehavior | undefined; + /** + * Billing interval. For consumable features, should match reset.interval. + */ + interval: MultiAttachItemPriceInterval; + /** + * 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: MultiAttachBillingMethod; + /** + * 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 MultiAttachOnIncrease = { + 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 MultiAttachOnIncrease = ClosedEnum; + +/** + * Credit behavior when quantity decreases mid-cycle. + */ +export const MultiAttachOnDecrease = { + 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 MultiAttachOnDecrease = ClosedEnum; + +/** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ +export type MultiAttachProration = { + /** + * Billing behavior when quantity increases mid-cycle. + */ + onIncrease: MultiAttachOnIncrease; + /** + * Credit behavior when quantity decreases mid-cycle. + */ + onDecrease: MultiAttachOnDecrease; +}; + +/** + * When rolled over units expire. + */ +export const MultiAttachExpiryDurationType = { + Month: "month", + Forever: "forever", +} as const; +/** + * When rolled over units expire. + */ +export type MultiAttachExpiryDurationType = ClosedEnum< + typeof MultiAttachExpiryDurationType +>; + +/** + * Rollover config for unused units. If set, unused included units carry over. + */ +export type MultiAttachRollover = { + /** + * Max rollover units. Omit for unlimited rollover. + */ + max?: number | undefined; + /** + * When rolled over units expire. + */ + expiryDurationType: MultiAttachExpiryDurationType; + /** + * Number of periods before expiry. + */ + expiryDurationLength?: number | undefined; +}; + +/** + * Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings. + */ +export type MultiAttachPlanItem = { + /** + * 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?: MultiAttachReset | undefined; + /** + * Pricing for usage beyond included units. Omit for free features. + */ + price?: MultiAttachPrice | undefined; + /** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ + proration?: MultiAttachProration | undefined; + /** + * Rollover config for unused units. If set, unused included units carry over. + */ + rollover?: MultiAttachRollover | undefined; +}; + +/** + * Customize the plan to attach. Can override the price or items. + */ +export type MultiAttachCustomize = { + /** + * Override the base price of the plan. Pass null to remove the base price. + */ + price?: MultiAttachBasePrice | null | undefined; + /** + * Override the items in the plan. + */ + items?: Array | undefined; +}; + +/** + * Quantity configuration for a prepaid feature. + */ +export type MultiAttachFeatureQuantity = { + /** + * The ID of the feature to set quantity for. + */ + featureId: string; + /** + * The quantity of the feature. + */ + quantity?: number | undefined; + /** + * Whether the customer can adjust the quantity. + */ + adjustable?: boolean | undefined; +}; + +export type MultiAttachPlan = { + /** + * The ID of the plan to attach. + */ + planId: string; + /** + * Customize the plan to attach. Can override the price or items. + */ + customize?: MultiAttachCustomize | undefined; + /** + * If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. + */ + featureQuantities?: Array | undefined; + /** + * The version of the plan to attach. + */ + version?: number | undefined; +}; + +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ +export const MultiAttachDurationType = { + Day: "day", + Month: "month", + Year: "year", +} as const; +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ +export type MultiAttachDurationType = ClosedEnum< + typeof MultiAttachDurationType +>; + +/** + * Free trial configuration for a plan. + */ +export type MultiAttachFreeTrialParams = { + /** + * Number of duration_type periods the trial lasts. + */ + durationLength: number; + /** + * Unit of time for the trial ('day', 'month', 'year'). + */ + durationType?: MultiAttachDurationType | undefined; + /** + * If true, payment method required to start trial. Customer is charged after trial ends. + */ + cardRequired?: boolean | undefined; +}; + +/** + * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. + */ +export type MultiAttachInvoiceMode = { + /** + * When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + */ + enabled: boolean; + /** + * If true, enables the plan immediately even though the invoice is not paid yet. + */ + enablePlanImmediately?: boolean | undefined; + /** + * If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + */ + finalize?: boolean | undefined; +}; + +/** + * A discount to apply. Can be either a reward ID or a promotion code. + */ +export type MultiAttachAttachDiscount = { + /** + * The ID of the reward to apply as a discount. + */ + rewardId?: string | undefined; + /** + * The promotion code to apply as a discount. + */ + promotionCode?: string | undefined; +}; + +/** + * Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. + */ +export const MultiAttachRedirectMode = { + Always: "always", + IfRequired: "if_required", + Never: "never", +} as const; +/** + * Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. + */ +export type MultiAttachRedirectMode = ClosedEnum< + typeof MultiAttachRedirectMode +>; + +export type MultiAttachEntityData = { + /** + * The feature ID that this entity is associated with + */ + featureId: string; + /** + * Name of the entity + */ + name?: string | undefined; +}; + +export type MultiAttachParams = { + /** + * The ID of the customer to attach the plans to. + */ + customerId: string; + /** + * The ID of the entity to attach the plans to. + */ + entityId?: string | undefined; + /** + * The list of plans to attach to the customer. + */ + plans: Array; + /** + * Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. + */ + freeTrial?: MultiAttachFreeTrialParams | null | undefined; + /** + * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. + */ + invoiceMode?: MultiAttachInvoiceMode | undefined; + /** + * List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + */ + discounts?: Array | undefined; + /** + * URL to redirect to after successful checkout. + */ + successUrl?: string | undefined; + /** + * Additional parameters to pass into the creation of the Stripe checkout session. + */ + checkoutSessionParams?: { [k: string]: any } | undefined; + /** + * Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. + */ + redirectMode?: MultiAttachRedirectMode | undefined; + /** + * Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + */ + newBillingSubscription?: boolean | undefined; + /** + * Customer details to set when creating a customer + */ + customerData?: CustomerData | undefined; + entityData?: MultiAttachEntityData | undefined; +}; + +/** + * Invoice details if an invoice was created. Only present when a charge was made. + */ +export type MultiAttachInvoice = { + /** + * The status of the invoice (e.g., 'paid', 'open', 'draft'). + */ + status: string | null; + /** + * The Stripe invoice ID. + */ + stripeId: string; + /** + * The total amount of the invoice in cents. + */ + total: number; + /** + * The three-letter ISO currency code (e.g., 'usd'). + */ + currency: string; + /** + * URL to the hosted invoice page where the customer can view and pay the invoice. + */ + hostedInvoiceUrl: string | null; +}; + +/** + * The type of action required to complete the payment. + */ +export const MultiAttachCode = { + ThreedsRequired: "3ds_required", + PaymentMethodRequired: "payment_method_required", + PaymentFailed: "payment_failed", +} as const; +/** + * The type of action required to complete the payment. + */ +export type MultiAttachCode = OpenEnum; + +/** + * Details about any action required to complete the payment. Present when the payment could not be processed automatically. + */ +export type MultiAttachRequiredAction = { + /** + * The type of action required to complete the payment. + */ + code: MultiAttachCode; + /** + * A human-readable explanation of why this action is required. + */ + reason: string; +}; + +/** + * OK + */ +export type MultiAttachResponse = { + /** + * The ID of the customer. + */ + customerId: string; + /** + * The ID of the entity, if the plan was attached to an entity. + */ + entityId?: string | undefined; + /** + * Invoice details if an invoice was created. Only present when a charge was made. + */ + invoice?: MultiAttachInvoice | undefined; + /** + * URL to redirect the customer to complete payment. Null if no payment action is required. + */ + paymentUrl: string | null; + /** + * Details about any action required to complete the payment. Present when the payment could not be processed automatically. + */ + requiredAction?: MultiAttachRequiredAction | undefined; +}; + +/** @internal */ +export const MultiAttachPriceInterval$outboundSchema: z.ZodMiniEnum< + typeof MultiAttachPriceInterval +> = z.enum(MultiAttachPriceInterval); + +/** @internal */ +export type MultiAttachBasePrice$Outbound = { + amount: number; + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const MultiAttachBasePrice$outboundSchema: z.ZodMiniType< + MultiAttachBasePrice$Outbound, + MultiAttachBasePrice +> = z.pipe( + z.object({ + amount: z.number(), + interval: MultiAttachPriceInterval$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function multiAttachBasePriceToJSON( + multiAttachBasePrice: MultiAttachBasePrice, +): string { + return JSON.stringify( + MultiAttachBasePrice$outboundSchema.parse(multiAttachBasePrice), + ); +} + +/** @internal */ +export const MultiAttachResetInterval$outboundSchema: z.ZodMiniEnum< + typeof MultiAttachResetInterval +> = z.enum(MultiAttachResetInterval); + +/** @internal */ +export type MultiAttachReset$Outbound = { + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const MultiAttachReset$outboundSchema: z.ZodMiniType< + MultiAttachReset$Outbound, + MultiAttachReset +> = z.pipe( + z.object({ + interval: MultiAttachResetInterval$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function multiAttachResetToJSON( + multiAttachReset: MultiAttachReset, +): string { + return JSON.stringify( + MultiAttachReset$outboundSchema.parse(multiAttachReset), + ); +} + +/** @internal */ +export type MultiAttachTo$Outbound = number | string; + +/** @internal */ +export const MultiAttachTo$outboundSchema: z.ZodMiniType< + MultiAttachTo$Outbound, + MultiAttachTo +> = smartUnion([z.number(), z.string()]); + +export function multiAttachToToJSON(multiAttachTo: MultiAttachTo): string { + return JSON.stringify(MultiAttachTo$outboundSchema.parse(multiAttachTo)); +} + +/** @internal */ +export type MultiAttachTier$Outbound = { + to: number | string; + amount: number; + flat_amount?: number | null | undefined; +}; + +/** @internal */ +export const MultiAttachTier$outboundSchema: z.ZodMiniType< + MultiAttachTier$Outbound, + MultiAttachTier +> = z.pipe( + z.object({ + to: smartUnion([z.number(), z.string()]), + amount: z.number(), + flatAmount: z.optional(z.nullable(z.number())), + }), + z.transform((v) => { + return remap$(v, { + flatAmount: "flat_amount", + }); + }), +); + +export function multiAttachTierToJSON( + multiAttachTier: MultiAttachTier, +): string { + return JSON.stringify(MultiAttachTier$outboundSchema.parse(multiAttachTier)); +} + +/** @internal */ +export const MultiAttachTierBehavior$outboundSchema: z.ZodMiniEnum< + typeof MultiAttachTierBehavior +> = z.enum(MultiAttachTierBehavior); + +/** @internal */ +export const MultiAttachItemPriceInterval$outboundSchema: z.ZodMiniEnum< + typeof MultiAttachItemPriceInterval +> = z.enum(MultiAttachItemPriceInterval); + +/** @internal */ +export const MultiAttachBillingMethod$outboundSchema: z.ZodMiniEnum< + typeof MultiAttachBillingMethod +> = z.enum(MultiAttachBillingMethod); + +/** @internal */ +export type MultiAttachPrice$Outbound = { + amount?: number | undefined; + tiers?: Array | undefined; + tier_behavior?: string | undefined; + interval: string; + interval_count: number; + billing_units: number; + billing_method: string; + max_purchase?: number | undefined; +}; + +/** @internal */ +export const MultiAttachPrice$outboundSchema: z.ZodMiniType< + MultiAttachPrice$Outbound, + MultiAttachPrice +> = z.pipe( + z.object({ + amount: z.optional(z.number()), + tiers: z.optional(z.array(z.lazy(() => MultiAttachTier$outboundSchema))), + tierBehavior: z.optional(MultiAttachTierBehavior$outboundSchema), + interval: MultiAttachItemPriceInterval$outboundSchema, + intervalCount: z._default(z.number(), 1), + billingUnits: z._default(z.number(), 1), + billingMethod: MultiAttachBillingMethod$outboundSchema, + maxPurchase: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + tierBehavior: "tier_behavior", + intervalCount: "interval_count", + billingUnits: "billing_units", + billingMethod: "billing_method", + maxPurchase: "max_purchase", + }); + }), +); + +export function multiAttachPriceToJSON( + multiAttachPrice: MultiAttachPrice, +): string { + return JSON.stringify( + MultiAttachPrice$outboundSchema.parse(multiAttachPrice), + ); +} + +/** @internal */ +export const MultiAttachOnIncrease$outboundSchema: z.ZodMiniEnum< + typeof MultiAttachOnIncrease +> = z.enum(MultiAttachOnIncrease); + +/** @internal */ +export const MultiAttachOnDecrease$outboundSchema: z.ZodMiniEnum< + typeof MultiAttachOnDecrease +> = z.enum(MultiAttachOnDecrease); + +/** @internal */ +export type MultiAttachProration$Outbound = { + on_increase: string; + on_decrease: string; +}; + +/** @internal */ +export const MultiAttachProration$outboundSchema: z.ZodMiniType< + MultiAttachProration$Outbound, + MultiAttachProration +> = z.pipe( + z.object({ + onIncrease: MultiAttachOnIncrease$outboundSchema, + onDecrease: MultiAttachOnDecrease$outboundSchema, + }), + z.transform((v) => { + return remap$(v, { + onIncrease: "on_increase", + onDecrease: "on_decrease", + }); + }), +); + +export function multiAttachProrationToJSON( + multiAttachProration: MultiAttachProration, +): string { + return JSON.stringify( + MultiAttachProration$outboundSchema.parse(multiAttachProration), + ); +} + +/** @internal */ +export const MultiAttachExpiryDurationType$outboundSchema: z.ZodMiniEnum< + typeof MultiAttachExpiryDurationType +> = z.enum(MultiAttachExpiryDurationType); + +/** @internal */ +export type MultiAttachRollover$Outbound = { + max?: number | undefined; + expiry_duration_type: string; + expiry_duration_length?: number | undefined; +}; + +/** @internal */ +export const MultiAttachRollover$outboundSchema: z.ZodMiniType< + MultiAttachRollover$Outbound, + MultiAttachRollover +> = z.pipe( + z.object({ + max: z.optional(z.number()), + expiryDurationType: MultiAttachExpiryDurationType$outboundSchema, + expiryDurationLength: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + expiryDurationType: "expiry_duration_type", + expiryDurationLength: "expiry_duration_length", + }); + }), +); + +export function multiAttachRolloverToJSON( + multiAttachRollover: MultiAttachRollover, +): string { + return JSON.stringify( + MultiAttachRollover$outboundSchema.parse(multiAttachRollover), + ); +} + +/** @internal */ +export type MultiAttachPlanItem$Outbound = { + feature_id: string; + included?: number | undefined; + unlimited?: boolean | undefined; + reset?: MultiAttachReset$Outbound | undefined; + price?: MultiAttachPrice$Outbound | undefined; + proration?: MultiAttachProration$Outbound | undefined; + rollover?: MultiAttachRollover$Outbound | undefined; +}; + +/** @internal */ +export const MultiAttachPlanItem$outboundSchema: z.ZodMiniType< + MultiAttachPlanItem$Outbound, + MultiAttachPlanItem +> = z.pipe( + z.object({ + featureId: z.string(), + included: z.optional(z.number()), + unlimited: z.optional(z.boolean()), + reset: z.optional(z.lazy(() => MultiAttachReset$outboundSchema)), + price: z.optional(z.lazy(() => MultiAttachPrice$outboundSchema)), + proration: z.optional(z.lazy(() => MultiAttachProration$outboundSchema)), + rollover: z.optional(z.lazy(() => MultiAttachRollover$outboundSchema)), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function multiAttachPlanItemToJSON( + multiAttachPlanItem: MultiAttachPlanItem, +): string { + return JSON.stringify( + MultiAttachPlanItem$outboundSchema.parse(multiAttachPlanItem), + ); +} + +/** @internal */ +export type MultiAttachCustomize$Outbound = { + price?: MultiAttachBasePrice$Outbound | null | undefined; + items?: Array | undefined; +}; + +/** @internal */ +export const MultiAttachCustomize$outboundSchema: z.ZodMiniType< + MultiAttachCustomize$Outbound, + MultiAttachCustomize +> = z.object({ + price: z.optional( + z.nullable(z.lazy(() => MultiAttachBasePrice$outboundSchema)), + ), + items: z.optional(z.array(z.lazy(() => MultiAttachPlanItem$outboundSchema))), +}); + +export function multiAttachCustomizeToJSON( + multiAttachCustomize: MultiAttachCustomize, +): string { + return JSON.stringify( + MultiAttachCustomize$outboundSchema.parse(multiAttachCustomize), + ); +} + +/** @internal */ +export type MultiAttachFeatureQuantity$Outbound = { + feature_id: string; + quantity?: number | undefined; + adjustable?: boolean | undefined; +}; + +/** @internal */ +export const MultiAttachFeatureQuantity$outboundSchema: z.ZodMiniType< + MultiAttachFeatureQuantity$Outbound, + MultiAttachFeatureQuantity +> = z.pipe( + z.object({ + featureId: z.string(), + quantity: z.optional(z.number()), + adjustable: z.optional(z.boolean()), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function multiAttachFeatureQuantityToJSON( + multiAttachFeatureQuantity: MultiAttachFeatureQuantity, +): string { + return JSON.stringify( + MultiAttachFeatureQuantity$outboundSchema.parse(multiAttachFeatureQuantity), + ); +} + +/** @internal */ +export type MultiAttachPlan$Outbound = { + plan_id: string; + customize?: MultiAttachCustomize$Outbound | undefined; + feature_quantities?: Array | undefined; + version?: number | undefined; +}; + +/** @internal */ +export const MultiAttachPlan$outboundSchema: z.ZodMiniType< + MultiAttachPlan$Outbound, + MultiAttachPlan +> = z.pipe( + z.object({ + planId: z.string(), + customize: z.optional(z.lazy(() => MultiAttachCustomize$outboundSchema)), + featureQuantities: z.optional( + z.array(z.lazy(() => MultiAttachFeatureQuantity$outboundSchema)), + ), + version: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + planId: "plan_id", + featureQuantities: "feature_quantities", + }); + }), +); + +export function multiAttachPlanToJSON( + multiAttachPlan: MultiAttachPlan, +): string { + return JSON.stringify(MultiAttachPlan$outboundSchema.parse(multiAttachPlan)); +} + +/** @internal */ +export const MultiAttachDurationType$outboundSchema: z.ZodMiniEnum< + typeof MultiAttachDurationType +> = z.enum(MultiAttachDurationType); + +/** @internal */ +export type MultiAttachFreeTrialParams$Outbound = { + duration_length: number; + duration_type: string; + card_required: boolean; +}; + +/** @internal */ +export const MultiAttachFreeTrialParams$outboundSchema: z.ZodMiniType< + MultiAttachFreeTrialParams$Outbound, + MultiAttachFreeTrialParams +> = z.pipe( + z.object({ + durationLength: z.number(), + durationType: z._default(MultiAttachDurationType$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 multiAttachFreeTrialParamsToJSON( + multiAttachFreeTrialParams: MultiAttachFreeTrialParams, +): string { + return JSON.stringify( + MultiAttachFreeTrialParams$outboundSchema.parse(multiAttachFreeTrialParams), + ); +} + +/** @internal */ +export type MultiAttachInvoiceMode$Outbound = { + enabled: boolean; + enable_plan_immediately: boolean; + finalize: boolean; +}; + +/** @internal */ +export const MultiAttachInvoiceMode$outboundSchema: z.ZodMiniType< + MultiAttachInvoiceMode$Outbound, + MultiAttachInvoiceMode +> = z.pipe( + z.object({ + enabled: z.boolean(), + enablePlanImmediately: z._default(z.boolean(), false), + finalize: z._default(z.boolean(), true), + }), + z.transform((v) => { + return remap$(v, { + enablePlanImmediately: "enable_plan_immediately", + }); + }), +); + +export function multiAttachInvoiceModeToJSON( + multiAttachInvoiceMode: MultiAttachInvoiceMode, +): string { + return JSON.stringify( + MultiAttachInvoiceMode$outboundSchema.parse(multiAttachInvoiceMode), + ); +} + +/** @internal */ +export type MultiAttachAttachDiscount$Outbound = { + reward_id?: string | undefined; + promotion_code?: string | undefined; +}; + +/** @internal */ +export const MultiAttachAttachDiscount$outboundSchema: z.ZodMiniType< + MultiAttachAttachDiscount$Outbound, + MultiAttachAttachDiscount +> = z.pipe( + z.object({ + rewardId: z.optional(z.string()), + promotionCode: z.optional(z.string()), + }), + z.transform((v) => { + return remap$(v, { + rewardId: "reward_id", + promotionCode: "promotion_code", + }); + }), +); + +export function multiAttachAttachDiscountToJSON( + multiAttachAttachDiscount: MultiAttachAttachDiscount, +): string { + return JSON.stringify( + MultiAttachAttachDiscount$outboundSchema.parse(multiAttachAttachDiscount), + ); +} + +/** @internal */ +export const MultiAttachRedirectMode$outboundSchema: z.ZodMiniEnum< + typeof MultiAttachRedirectMode +> = z.enum(MultiAttachRedirectMode); + +/** @internal */ +export type MultiAttachEntityData$Outbound = { + feature_id: string; + name?: string | undefined; +}; + +/** @internal */ +export const MultiAttachEntityData$outboundSchema: z.ZodMiniType< + MultiAttachEntityData$Outbound, + MultiAttachEntityData +> = z.pipe( + z.object({ + featureId: z.string(), + name: z.optional(z.string()), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function multiAttachEntityDataToJSON( + multiAttachEntityData: MultiAttachEntityData, +): string { + return JSON.stringify( + MultiAttachEntityData$outboundSchema.parse(multiAttachEntityData), + ); +} + +/** @internal */ +export type MultiAttachParams$Outbound = { + customer_id: string; + entity_id?: string | undefined; + plans: Array; + free_trial?: MultiAttachFreeTrialParams$Outbound | null | undefined; + invoice_mode?: MultiAttachInvoiceMode$Outbound | undefined; + discounts?: Array | undefined; + success_url?: string | undefined; + checkout_session_params?: { [k: string]: any } | undefined; + redirect_mode: string; + new_billing_subscription?: boolean | undefined; + customer_data?: CustomerData$Outbound | undefined; + entity_data?: MultiAttachEntityData$Outbound | undefined; +}; + +/** @internal */ +export const MultiAttachParams$outboundSchema: z.ZodMiniType< + MultiAttachParams$Outbound, + MultiAttachParams +> = z.pipe( + z.object({ + customerId: z.string(), + entityId: z.optional(z.string()), + plans: z.array(z.lazy(() => MultiAttachPlan$outboundSchema)), + freeTrial: z.optional( + z.nullable(z.lazy(() => MultiAttachFreeTrialParams$outboundSchema)), + ), + invoiceMode: z.optional( + z.lazy(() => MultiAttachInvoiceMode$outboundSchema), + ), + discounts: z.optional( + z.array(z.lazy(() => MultiAttachAttachDiscount$outboundSchema)), + ), + successUrl: z.optional(z.string()), + checkoutSessionParams: z.optional(z.record(z.string(), z.any())), + redirectMode: z._default( + MultiAttachRedirectMode$outboundSchema, + "if_required", + ), + newBillingSubscription: z.optional(z.boolean()), + customerData: z.optional(CustomerData$outboundSchema), + entityData: z.optional(z.lazy(() => MultiAttachEntityData$outboundSchema)), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + entityId: "entity_id", + freeTrial: "free_trial", + invoiceMode: "invoice_mode", + successUrl: "success_url", + checkoutSessionParams: "checkout_session_params", + redirectMode: "redirect_mode", + newBillingSubscription: "new_billing_subscription", + customerData: "customer_data", + entityData: "entity_data", + }); + }), +); + +export function multiAttachParamsToJSON( + multiAttachParams: MultiAttachParams, +): string { + return JSON.stringify( + MultiAttachParams$outboundSchema.parse(multiAttachParams), + ); +} + +/** @internal */ +export const MultiAttachInvoice$inboundSchema: z.ZodMiniType< + MultiAttachInvoice, + unknown +> = z.pipe( + z.object({ + status: types.nullable(types.string()), + stripe_id: types.string(), + total: types.number(), + currency: types.string(), + hosted_invoice_url: types.nullable(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "stripe_id": "stripeId", + "hosted_invoice_url": "hostedInvoiceUrl", + }); + }), +); + +export function multiAttachInvoiceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MultiAttachInvoice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MultiAttachInvoice' from JSON`, + ); +} + +/** @internal */ +export const MultiAttachCode$inboundSchema: z.ZodMiniType< + MultiAttachCode, + unknown +> = openEnums.inboundSchema(MultiAttachCode); + +/** @internal */ +export const MultiAttachRequiredAction$inboundSchema: z.ZodMiniType< + MultiAttachRequiredAction, + unknown +> = z.object({ + code: MultiAttachCode$inboundSchema, + reason: types.string(), +}); + +export function multiAttachRequiredActionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MultiAttachRequiredAction$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MultiAttachRequiredAction' from JSON`, + ); +} + +/** @internal */ +export const MultiAttachResponse$inboundSchema: z.ZodMiniType< + MultiAttachResponse, + unknown +> = z.pipe( + z.object({ + customer_id: types.string(), + entity_id: types.optional(types.string()), + invoice: types.optional(z.lazy(() => MultiAttachInvoice$inboundSchema)), + payment_url: types.nullable(types.string()), + required_action: types.optional( + z.lazy(() => MultiAttachRequiredAction$inboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + "customer_id": "customerId", + "entity_id": "entityId", + "payment_url": "paymentUrl", + "required_action": "requiredAction", + }); + }), +); + +export function multiAttachResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MultiAttachResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MultiAttachResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/plan.ts b/packages/sdk/src/models/plan.ts index 532f8e222..ae6b0bdb1 100644 --- a/packages/sdk/src/models/plan.ts +++ b/packages/sdk/src/models/plan.ts @@ -163,8 +163,15 @@ export type PlanTo = number | string; export type PlanTier = { to: number | string; amount: number; + flatAmount?: number | null | undefined; }; +export const PlanTierBehavior = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type PlanTierBehavior = OpenEnum; + /** * Billing interval for this price. For consumable features, should match reset.interval. */ @@ -199,9 +206,10 @@ export type PlanItemPrice = { */ amount?: number | undefined; /** - * Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + * Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. */ tiers?: Array | undefined; + tierBehavior?: PlanTierBehavior | undefined; /** * Billing interval for this price. For consumable features, should match reset.interval. */ @@ -346,6 +354,36 @@ export const PlanEnv = { */ export type PlanEnv = OpenEnum; +/** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ +export const Scenario = { + Scheduled: "scheduled", + Active: "active", + New: "new", + Renew: "renew", + Upgrade: "upgrade", + Downgrade: "downgrade", + Cancel: "cancel", + Expired: "expired", + PastDue: "past_due", +} as const; +/** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ +export type Scenario = OpenEnum; + +export type CustomerEligibility = { + /** + * Whether a free trial is available for this customer. + */ + trialAvailable?: boolean | undefined; + /** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ + scenario: Scenario; +}; + export type Plan = { /** * Unique identifier for the plan. @@ -403,6 +441,7 @@ export type Plan = { * If this is a variant, the ID of the base plan it was created from. */ baseVariantId: string | null; + customerEligibility?: CustomerEligibility | undefined; }; /** @internal */ @@ -593,11 +632,18 @@ export function planToFromJSON( } /** @internal */ -export const PlanTier$inboundSchema: z.ZodMiniType = z - .object({ +export const PlanTier$inboundSchema: z.ZodMiniType = z.pipe( + z.object({ to: smartUnion([types.number(), types.string()]), amount: types.number(), - }); + flat_amount: z.optional(z.nullable(types.number())), + }), + z.transform((v) => { + return remap$(v, { + "flat_amount": "flatAmount", + }); + }), +); export function planTierFromJSON( jsonString: string, @@ -609,6 +655,12 @@ export function planTierFromJSON( ); } +/** @internal */ +export const PlanTierBehavior$inboundSchema: z.ZodMiniType< + PlanTierBehavior, + unknown +> = openEnums.inboundSchema(PlanTierBehavior); + /** @internal */ export const PlanPriceItemInterval$inboundSchema: z.ZodMiniType< PlanPriceItemInterval, @@ -629,6 +681,7 @@ export const PlanItemPrice$inboundSchema: z.ZodMiniType< z.object({ amount: types.optional(types.number()), tiers: types.optional(z.array(z.lazy(() => PlanTier$inboundSchema))), + tier_behavior: types.optional(PlanTierBehavior$inboundSchema), interval: PlanPriceItemInterval$inboundSchema, interval_count: types.optional(types.number()), billing_units: types.number(), @@ -637,6 +690,7 @@ export const PlanItemPrice$inboundSchema: z.ZodMiniType< }), z.transform((v) => { return remap$(v, { + "tier_behavior": "tierBehavior", "interval_count": "intervalCount", "billing_units": "billingUnits", "billing_method": "billingMethod", @@ -780,6 +834,36 @@ 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({ @@ -797,6 +881,9 @@ 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, { @@ -805,6 +892,7 @@ 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 150c2ba69..6a8b31601 100644 --- a/packages/sdk/src/models/preview-attach-op.ts +++ b/packages/sdk/src/models/preview-attach-op.ts @@ -109,8 +109,17 @@ export type PreviewAttachTo = number | string; export type PreviewAttachTier = { to: number | string; amount: number; + flatAmount?: number | null | undefined; }; +export const PreviewAttachTierBehavior = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type PreviewAttachTierBehavior = ClosedEnum< + typeof PreviewAttachTierBehavior +>; + /** * Billing interval. For consumable features, should match reset.interval. */ @@ -152,9 +161,10 @@ export type PreviewAttachPrice = { */ amount?: number | undefined; /** - * Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + * Tiered pricing. Either 'amount' or 'tiers' is required. */ tiers?: Array | undefined; + tierBehavior?: PreviewAttachTierBehavior | undefined; /** * Billing interval. For consumable features, should match reset.interval. */ @@ -450,6 +460,10 @@ export type PreviewAttachParams = { * When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. */ planSchedule?: PreviewAttachPlanSchedule | undefined; + /** + * Additional parameters to pass into the creation of the Stripe checkout session. + */ + checkoutSessionParams?: { [k: string]: any } | undefined; }; export type PreviewAttachDiscount = { @@ -643,16 +657,25 @@ export function previewAttachToToJSON( export type PreviewAttachTier$Outbound = { to: number | string; amount: number; + flat_amount?: number | null | undefined; }; /** @internal */ export const PreviewAttachTier$outboundSchema: z.ZodMiniType< PreviewAttachTier$Outbound, PreviewAttachTier -> = z.object({ - to: smartUnion([z.number(), z.string()]), - amount: z.number(), -}); +> = z.pipe( + z.object({ + to: smartUnion([z.number(), z.string()]), + amount: z.number(), + flatAmount: z.optional(z.nullable(z.number())), + }), + z.transform((v) => { + return remap$(v, { + flatAmount: "flat_amount", + }); + }), +); export function previewAttachTierToJSON( previewAttachTier: PreviewAttachTier, @@ -662,6 +685,11 @@ export function previewAttachTierToJSON( ); } +/** @internal */ +export const PreviewAttachTierBehavior$outboundSchema: z.ZodMiniEnum< + typeof PreviewAttachTierBehavior +> = z.enum(PreviewAttachTierBehavior); + /** @internal */ export const PreviewAttachItemPriceInterval$outboundSchema: z.ZodMiniEnum< typeof PreviewAttachItemPriceInterval @@ -676,6 +704,7 @@ export const PreviewAttachBillingMethod$outboundSchema: z.ZodMiniEnum< export type PreviewAttachPrice$Outbound = { amount?: number | undefined; tiers?: Array | undefined; + tier_behavior?: string | undefined; interval: string; interval_count: number; billing_units: number; @@ -691,6 +720,7 @@ export const PreviewAttachPrice$outboundSchema: z.ZodMiniType< z.object({ amount: z.optional(z.number()), tiers: z.optional(z.array(z.lazy(() => PreviewAttachTier$outboundSchema))), + tierBehavior: z.optional(PreviewAttachTierBehavior$outboundSchema), interval: PreviewAttachItemPriceInterval$outboundSchema, intervalCount: z._default(z.number(), 1), billingUnits: z._default(z.number(), 1), @@ -699,6 +729,7 @@ export const PreviewAttachPrice$outboundSchema: z.ZodMiniType< }), z.transform((v) => { return remap$(v, { + tierBehavior: "tier_behavior", intervalCount: "interval_count", billingUnits: "billing_units", billingMethod: "billing_method", @@ -1002,6 +1033,7 @@ export type PreviewAttachParams$Outbound = { success_url?: string | undefined; new_billing_subscription?: boolean | undefined; plan_schedule?: string | undefined; + checkout_session_params?: { [k: string]: any } | undefined; }; /** @internal */ @@ -1030,6 +1062,7 @@ export const PreviewAttachParams$outboundSchema: z.ZodMiniType< successUrl: z.optional(z.string()), newBillingSubscription: z.optional(z.boolean()), planSchedule: z.optional(PreviewAttachPlanSchedule$outboundSchema), + checkoutSessionParams: z.optional(z.record(z.string(), z.any())), }), z.transform((v) => { return remap$(v, { @@ -1042,6 +1075,7 @@ export const PreviewAttachParams$outboundSchema: z.ZodMiniType< successUrl: "success_url", newBillingSubscription: "new_billing_subscription", planSchedule: "plan_schedule", + checkoutSessionParams: "checkout_session_params", }); }), ); diff --git a/packages/sdk/src/models/preview-multi-attach-op.ts b/packages/sdk/src/models/preview-multi-attach-op.ts new file mode 100644 index 000000000..7be5d78af --- /dev/null +++ b/packages/sdk/src/models/preview-multi-attach-op.ts @@ -0,0 +1,1282 @@ +/* + * 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 { ClosedEnum } 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 { + CustomerData, + CustomerData$Outbound, + CustomerData$outboundSchema, +} from "./customer-data.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type PreviewMultiAttachGlobals = { + xApiVersion?: string | undefined; +}; + +/** + * Billing interval (e.g. 'month', 'year'). + */ +export const PreviewMultiAttachPriceInterval = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ +export type PreviewMultiAttachPriceInterval = ClosedEnum< + typeof PreviewMultiAttachPriceInterval +>; + +/** + * Base price configuration for a plan. + */ +export type PreviewMultiAttachBasePrice = { + /** + * Base price amount for the plan. + */ + amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ + interval: PreviewMultiAttachPriceInterval; + /** + * 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 PreviewMultiAttachResetInterval = { + 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 PreviewMultiAttachResetInterval = ClosedEnum< + typeof PreviewMultiAttachResetInterval +>; + +/** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ +export type PreviewMultiAttachReset = { + /** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ + interval: PreviewMultiAttachResetInterval; + /** + * Number of intervals between resets. Defaults to 1. + */ + intervalCount?: number | undefined; +}; + +export type PreviewMultiAttachTo = number | string; + +export type PreviewMultiAttachTier = { + to: number | string; + amount: number; + flatAmount?: number | null | undefined; +}; + +export const PreviewMultiAttachTierBehavior = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type PreviewMultiAttachTierBehavior = ClosedEnum< + typeof PreviewMultiAttachTierBehavior +>; + +/** + * Billing interval. For consumable features, should match reset.interval. + */ +export const PreviewMultiAttachItemPriceInterval = { + 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 PreviewMultiAttachItemPriceInterval = ClosedEnum< + typeof PreviewMultiAttachItemPriceInterval +>; + +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ +export const PreviewMultiAttachBillingMethod = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ +export type PreviewMultiAttachBillingMethod = ClosedEnum< + typeof PreviewMultiAttachBillingMethod +>; + +/** + * Pricing for usage beyond included units. Omit for free features. + */ +export type PreviewMultiAttachPrice = { + /** + * Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + */ + amount?: number | undefined; + /** + * Tiered pricing. Either 'amount' or 'tiers' is required. + */ + tiers?: Array | undefined; + tierBehavior?: PreviewMultiAttachTierBehavior | undefined; + /** + * Billing interval. For consumable features, should match reset.interval. + */ + interval: PreviewMultiAttachItemPriceInterval; + /** + * 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: PreviewMultiAttachBillingMethod; + /** + * 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 PreviewMultiAttachOnIncrease = { + 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 PreviewMultiAttachOnIncrease = ClosedEnum< + typeof PreviewMultiAttachOnIncrease +>; + +/** + * Credit behavior when quantity decreases mid-cycle. + */ +export const PreviewMultiAttachOnDecrease = { + 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 PreviewMultiAttachOnDecrease = ClosedEnum< + typeof PreviewMultiAttachOnDecrease +>; + +/** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ +export type PreviewMultiAttachProration = { + /** + * Billing behavior when quantity increases mid-cycle. + */ + onIncrease: PreviewMultiAttachOnIncrease; + /** + * Credit behavior when quantity decreases mid-cycle. + */ + onDecrease: PreviewMultiAttachOnDecrease; +}; + +/** + * When rolled over units expire. + */ +export const PreviewMultiAttachExpiryDurationType = { + Month: "month", + Forever: "forever", +} as const; +/** + * When rolled over units expire. + */ +export type PreviewMultiAttachExpiryDurationType = ClosedEnum< + typeof PreviewMultiAttachExpiryDurationType +>; + +/** + * Rollover config for unused units. If set, unused included units carry over. + */ +export type PreviewMultiAttachRollover = { + /** + * Max rollover units. Omit for unlimited rollover. + */ + max?: number | undefined; + /** + * When rolled over units expire. + */ + expiryDurationType: PreviewMultiAttachExpiryDurationType; + /** + * Number of periods before expiry. + */ + expiryDurationLength?: number | undefined; +}; + +/** + * Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings. + */ +export type PreviewMultiAttachPlanItem = { + /** + * 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?: PreviewMultiAttachReset | undefined; + /** + * Pricing for usage beyond included units. Omit for free features. + */ + price?: PreviewMultiAttachPrice | undefined; + /** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ + proration?: PreviewMultiAttachProration | undefined; + /** + * Rollover config for unused units. If set, unused included units carry over. + */ + rollover?: PreviewMultiAttachRollover | undefined; +}; + +/** + * Customize the plan to attach. Can override the price or items. + */ +export type PreviewMultiAttachCustomize = { + /** + * Override the base price of the plan. Pass null to remove the base price. + */ + price?: PreviewMultiAttachBasePrice | null | undefined; + /** + * Override the items in the plan. + */ + items?: Array | undefined; +}; + +/** + * Quantity configuration for a prepaid feature. + */ +export type PreviewMultiAttachFeatureQuantity = { + /** + * The ID of the feature to set quantity for. + */ + featureId: string; + /** + * The quantity of the feature. + */ + quantity?: number | undefined; + /** + * Whether the customer can adjust the quantity. + */ + adjustable?: boolean | undefined; +}; + +export type PreviewMultiAttachPlan = { + /** + * The ID of the plan to attach. + */ + planId: string; + /** + * Customize the plan to attach. Can override the price or items. + */ + customize?: PreviewMultiAttachCustomize | undefined; + /** + * If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. + */ + featureQuantities?: Array | undefined; + /** + * The version of the plan to attach. + */ + version?: number | undefined; +}; + +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ +export const PreviewMultiAttachDurationType = { + Day: "day", + Month: "month", + Year: "year", +} as const; +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ +export type PreviewMultiAttachDurationType = ClosedEnum< + typeof PreviewMultiAttachDurationType +>; + +/** + * Free trial configuration for a plan. + */ +export type PreviewMultiAttachFreeTrialParams = { + /** + * Number of duration_type periods the trial lasts. + */ + durationLength: number; + /** + * Unit of time for the trial ('day', 'month', 'year'). + */ + durationType?: PreviewMultiAttachDurationType | undefined; + /** + * If true, payment method required to start trial. Customer is charged after trial ends. + */ + cardRequired?: boolean | undefined; +}; + +/** + * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. + */ +export type PreviewMultiAttachInvoiceMode = { + /** + * When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + */ + enabled: boolean; + /** + * If true, enables the plan immediately even though the invoice is not paid yet. + */ + enablePlanImmediately?: boolean | undefined; + /** + * If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + */ + finalize?: boolean | undefined; +}; + +/** + * A discount to apply. Can be either a reward ID or a promotion code. + */ +export type PreviewMultiAttachAttachDiscount = { + /** + * The ID of the reward to apply as a discount. + */ + rewardId?: string | undefined; + /** + * The promotion code to apply as a discount. + */ + promotionCode?: string | undefined; +}; + +/** + * Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. + */ +export const PreviewMultiAttachRedirectMode = { + Always: "always", + IfRequired: "if_required", + Never: "never", +} as const; +/** + * Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. + */ +export type PreviewMultiAttachRedirectMode = ClosedEnum< + typeof PreviewMultiAttachRedirectMode +>; + +export type PreviewMultiAttachEntityData = { + /** + * The feature ID that this entity is associated with + */ + featureId: string; + /** + * Name of the entity + */ + name?: string | undefined; +}; + +export type PreviewMultiAttachParams = { + /** + * The ID of the customer to attach the plans to. + */ + customerId: string; + /** + * The ID of the entity to attach the plans to. + */ + entityId?: string | undefined; + /** + * The list of plans to attach to the customer. + */ + plans: Array; + /** + * Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. + */ + freeTrial?: PreviewMultiAttachFreeTrialParams | null | undefined; + /** + * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. + */ + invoiceMode?: PreviewMultiAttachInvoiceMode | undefined; + /** + * List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + */ + discounts?: Array | undefined; + /** + * URL to redirect to after successful checkout. + */ + successUrl?: string | undefined; + /** + * Additional parameters to pass into the creation of the Stripe checkout session. + */ + checkoutSessionParams?: { [k: string]: any } | undefined; + /** + * Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. + */ + redirectMode?: PreviewMultiAttachRedirectMode | undefined; + /** + * Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + */ + newBillingSubscription?: boolean | undefined; + /** + * Customer details to set when creating a customer + */ + customerData?: CustomerData | undefined; + entityData?: PreviewMultiAttachEntityData | undefined; +}; + +export type PreviewMultiAttachDiscount = { + amountOff: number; + percentOff?: number | undefined; + stripeCouponId?: string | undefined; + couponName?: string | undefined; +}; + +export type PreviewMultiAttachLineItem = { + /** + * The title of the line item. + */ + title: string; + /** + * A detailed description of the line item. + */ + description: string; + /** + * The amount in cents for this line item. + */ + amount: number; + /** + * List of discounts applied to this line item. + */ + discounts?: Array | undefined; +}; + +/** + * Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. + */ +export type PreviewMultiAttachNextCycle = { + /** + * Unix timestamp (milliseconds) when the next billing cycle starts. + */ + startsAt: number; + /** + * The total amount in cents for the next cycle. + */ + total: number; +}; + +/** + * OK + */ +export type PreviewMultiAttachResponse = { + /** + * The ID of the customer. + */ + customerId: string; + /** + * List of line items for the current billing period. + */ + lineItems: Array; + /** + * The total amount in cents for the current billing period. + */ + total: number; + /** + * The three-letter ISO currency code (e.g., 'usd'). + */ + currency: string; + /** + * Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. + */ + nextCycle?: PreviewMultiAttachNextCycle | undefined; +}; + +/** @internal */ +export const PreviewMultiAttachPriceInterval$outboundSchema: z.ZodMiniEnum< + typeof PreviewMultiAttachPriceInterval +> = z.enum(PreviewMultiAttachPriceInterval); + +/** @internal */ +export type PreviewMultiAttachBasePrice$Outbound = { + amount: number; + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const PreviewMultiAttachBasePrice$outboundSchema: z.ZodMiniType< + PreviewMultiAttachBasePrice$Outbound, + PreviewMultiAttachBasePrice +> = z.pipe( + z.object({ + amount: z.number(), + interval: PreviewMultiAttachPriceInterval$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function previewMultiAttachBasePriceToJSON( + previewMultiAttachBasePrice: PreviewMultiAttachBasePrice, +): string { + return JSON.stringify( + PreviewMultiAttachBasePrice$outboundSchema.parse( + previewMultiAttachBasePrice, + ), + ); +} + +/** @internal */ +export const PreviewMultiAttachResetInterval$outboundSchema: z.ZodMiniEnum< + typeof PreviewMultiAttachResetInterval +> = z.enum(PreviewMultiAttachResetInterval); + +/** @internal */ +export type PreviewMultiAttachReset$Outbound = { + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const PreviewMultiAttachReset$outboundSchema: z.ZodMiniType< + PreviewMultiAttachReset$Outbound, + PreviewMultiAttachReset +> = z.pipe( + z.object({ + interval: PreviewMultiAttachResetInterval$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function previewMultiAttachResetToJSON( + previewMultiAttachReset: PreviewMultiAttachReset, +): string { + return JSON.stringify( + PreviewMultiAttachReset$outboundSchema.parse(previewMultiAttachReset), + ); +} + +/** @internal */ +export type PreviewMultiAttachTo$Outbound = number | string; + +/** @internal */ +export const PreviewMultiAttachTo$outboundSchema: z.ZodMiniType< + PreviewMultiAttachTo$Outbound, + PreviewMultiAttachTo +> = smartUnion([z.number(), z.string()]); + +export function previewMultiAttachToToJSON( + previewMultiAttachTo: PreviewMultiAttachTo, +): string { + return JSON.stringify( + PreviewMultiAttachTo$outboundSchema.parse(previewMultiAttachTo), + ); +} + +/** @internal */ +export type PreviewMultiAttachTier$Outbound = { + to: number | string; + amount: number; + flat_amount?: number | null | undefined; +}; + +/** @internal */ +export const PreviewMultiAttachTier$outboundSchema: z.ZodMiniType< + PreviewMultiAttachTier$Outbound, + PreviewMultiAttachTier +> = z.pipe( + z.object({ + to: smartUnion([z.number(), z.string()]), + amount: z.number(), + flatAmount: z.optional(z.nullable(z.number())), + }), + z.transform((v) => { + return remap$(v, { + flatAmount: "flat_amount", + }); + }), +); + +export function previewMultiAttachTierToJSON( + previewMultiAttachTier: PreviewMultiAttachTier, +): string { + return JSON.stringify( + PreviewMultiAttachTier$outboundSchema.parse(previewMultiAttachTier), + ); +} + +/** @internal */ +export const PreviewMultiAttachTierBehavior$outboundSchema: z.ZodMiniEnum< + typeof PreviewMultiAttachTierBehavior +> = z.enum(PreviewMultiAttachTierBehavior); + +/** @internal */ +export const PreviewMultiAttachItemPriceInterval$outboundSchema: z.ZodMiniEnum< + typeof PreviewMultiAttachItemPriceInterval +> = z.enum(PreviewMultiAttachItemPriceInterval); + +/** @internal */ +export const PreviewMultiAttachBillingMethod$outboundSchema: z.ZodMiniEnum< + typeof PreviewMultiAttachBillingMethod +> = z.enum(PreviewMultiAttachBillingMethod); + +/** @internal */ +export type PreviewMultiAttachPrice$Outbound = { + amount?: number | undefined; + tiers?: Array | undefined; + tier_behavior?: string | undefined; + interval: string; + interval_count: number; + billing_units: number; + billing_method: string; + max_purchase?: number | undefined; +}; + +/** @internal */ +export const PreviewMultiAttachPrice$outboundSchema: z.ZodMiniType< + PreviewMultiAttachPrice$Outbound, + PreviewMultiAttachPrice +> = z.pipe( + z.object({ + amount: z.optional(z.number()), + tiers: z.optional( + z.array(z.lazy(() => PreviewMultiAttachTier$outboundSchema)), + ), + tierBehavior: z.optional(PreviewMultiAttachTierBehavior$outboundSchema), + interval: PreviewMultiAttachItemPriceInterval$outboundSchema, + intervalCount: z._default(z.number(), 1), + billingUnits: z._default(z.number(), 1), + billingMethod: PreviewMultiAttachBillingMethod$outboundSchema, + maxPurchase: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + tierBehavior: "tier_behavior", + intervalCount: "interval_count", + billingUnits: "billing_units", + billingMethod: "billing_method", + maxPurchase: "max_purchase", + }); + }), +); + +export function previewMultiAttachPriceToJSON( + previewMultiAttachPrice: PreviewMultiAttachPrice, +): string { + return JSON.stringify( + PreviewMultiAttachPrice$outboundSchema.parse(previewMultiAttachPrice), + ); +} + +/** @internal */ +export const PreviewMultiAttachOnIncrease$outboundSchema: z.ZodMiniEnum< + typeof PreviewMultiAttachOnIncrease +> = z.enum(PreviewMultiAttachOnIncrease); + +/** @internal */ +export const PreviewMultiAttachOnDecrease$outboundSchema: z.ZodMiniEnum< + typeof PreviewMultiAttachOnDecrease +> = z.enum(PreviewMultiAttachOnDecrease); + +/** @internal */ +export type PreviewMultiAttachProration$Outbound = { + on_increase: string; + on_decrease: string; +}; + +/** @internal */ +export const PreviewMultiAttachProration$outboundSchema: z.ZodMiniType< + PreviewMultiAttachProration$Outbound, + PreviewMultiAttachProration +> = z.pipe( + z.object({ + onIncrease: PreviewMultiAttachOnIncrease$outboundSchema, + onDecrease: PreviewMultiAttachOnDecrease$outboundSchema, + }), + z.transform((v) => { + return remap$(v, { + onIncrease: "on_increase", + onDecrease: "on_decrease", + }); + }), +); + +export function previewMultiAttachProrationToJSON( + previewMultiAttachProration: PreviewMultiAttachProration, +): string { + return JSON.stringify( + PreviewMultiAttachProration$outboundSchema.parse( + previewMultiAttachProration, + ), + ); +} + +/** @internal */ +export const PreviewMultiAttachExpiryDurationType$outboundSchema: z.ZodMiniEnum< + typeof PreviewMultiAttachExpiryDurationType +> = z.enum(PreviewMultiAttachExpiryDurationType); + +/** @internal */ +export type PreviewMultiAttachRollover$Outbound = { + max?: number | undefined; + expiry_duration_type: string; + expiry_duration_length?: number | undefined; +}; + +/** @internal */ +export const PreviewMultiAttachRollover$outboundSchema: z.ZodMiniType< + PreviewMultiAttachRollover$Outbound, + PreviewMultiAttachRollover +> = z.pipe( + z.object({ + max: z.optional(z.number()), + expiryDurationType: PreviewMultiAttachExpiryDurationType$outboundSchema, + expiryDurationLength: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + expiryDurationType: "expiry_duration_type", + expiryDurationLength: "expiry_duration_length", + }); + }), +); + +export function previewMultiAttachRolloverToJSON( + previewMultiAttachRollover: PreviewMultiAttachRollover, +): string { + return JSON.stringify( + PreviewMultiAttachRollover$outboundSchema.parse(previewMultiAttachRollover), + ); +} + +/** @internal */ +export type PreviewMultiAttachPlanItem$Outbound = { + feature_id: string; + included?: number | undefined; + unlimited?: boolean | undefined; + reset?: PreviewMultiAttachReset$Outbound | undefined; + price?: PreviewMultiAttachPrice$Outbound | undefined; + proration?: PreviewMultiAttachProration$Outbound | undefined; + rollover?: PreviewMultiAttachRollover$Outbound | undefined; +}; + +/** @internal */ +export const PreviewMultiAttachPlanItem$outboundSchema: z.ZodMiniType< + PreviewMultiAttachPlanItem$Outbound, + PreviewMultiAttachPlanItem +> = z.pipe( + z.object({ + featureId: z.string(), + included: z.optional(z.number()), + unlimited: z.optional(z.boolean()), + reset: z.optional(z.lazy(() => PreviewMultiAttachReset$outboundSchema)), + price: z.optional(z.lazy(() => PreviewMultiAttachPrice$outboundSchema)), + proration: z.optional( + z.lazy(() => PreviewMultiAttachProration$outboundSchema), + ), + rollover: z.optional( + z.lazy(() => PreviewMultiAttachRollover$outboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function previewMultiAttachPlanItemToJSON( + previewMultiAttachPlanItem: PreviewMultiAttachPlanItem, +): string { + return JSON.stringify( + PreviewMultiAttachPlanItem$outboundSchema.parse(previewMultiAttachPlanItem), + ); +} + +/** @internal */ +export type PreviewMultiAttachCustomize$Outbound = { + price?: PreviewMultiAttachBasePrice$Outbound | null | undefined; + items?: Array | undefined; +}; + +/** @internal */ +export const PreviewMultiAttachCustomize$outboundSchema: z.ZodMiniType< + PreviewMultiAttachCustomize$Outbound, + PreviewMultiAttachCustomize +> = z.object({ + price: z.optional( + z.nullable(z.lazy(() => PreviewMultiAttachBasePrice$outboundSchema)), + ), + items: z.optional( + z.array(z.lazy(() => PreviewMultiAttachPlanItem$outboundSchema)), + ), +}); + +export function previewMultiAttachCustomizeToJSON( + previewMultiAttachCustomize: PreviewMultiAttachCustomize, +): string { + return JSON.stringify( + PreviewMultiAttachCustomize$outboundSchema.parse( + previewMultiAttachCustomize, + ), + ); +} + +/** @internal */ +export type PreviewMultiAttachFeatureQuantity$Outbound = { + feature_id: string; + quantity?: number | undefined; + adjustable?: boolean | undefined; +}; + +/** @internal */ +export const PreviewMultiAttachFeatureQuantity$outboundSchema: z.ZodMiniType< + PreviewMultiAttachFeatureQuantity$Outbound, + PreviewMultiAttachFeatureQuantity +> = z.pipe( + z.object({ + featureId: z.string(), + quantity: z.optional(z.number()), + adjustable: z.optional(z.boolean()), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function previewMultiAttachFeatureQuantityToJSON( + previewMultiAttachFeatureQuantity: PreviewMultiAttachFeatureQuantity, +): string { + return JSON.stringify( + PreviewMultiAttachFeatureQuantity$outboundSchema.parse( + previewMultiAttachFeatureQuantity, + ), + ); +} + +/** @internal */ +export type PreviewMultiAttachPlan$Outbound = { + plan_id: string; + customize?: PreviewMultiAttachCustomize$Outbound | undefined; + feature_quantities?: + | Array + | undefined; + version?: number | undefined; +}; + +/** @internal */ +export const PreviewMultiAttachPlan$outboundSchema: z.ZodMiniType< + PreviewMultiAttachPlan$Outbound, + PreviewMultiAttachPlan +> = z.pipe( + z.object({ + planId: z.string(), + customize: z.optional( + z.lazy(() => PreviewMultiAttachCustomize$outboundSchema), + ), + featureQuantities: z.optional( + z.array(z.lazy(() => PreviewMultiAttachFeatureQuantity$outboundSchema)), + ), + version: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + planId: "plan_id", + featureQuantities: "feature_quantities", + }); + }), +); + +export function previewMultiAttachPlanToJSON( + previewMultiAttachPlan: PreviewMultiAttachPlan, +): string { + return JSON.stringify( + PreviewMultiAttachPlan$outboundSchema.parse(previewMultiAttachPlan), + ); +} + +/** @internal */ +export const PreviewMultiAttachDurationType$outboundSchema: z.ZodMiniEnum< + typeof PreviewMultiAttachDurationType +> = z.enum(PreviewMultiAttachDurationType); + +/** @internal */ +export type PreviewMultiAttachFreeTrialParams$Outbound = { + duration_length: number; + duration_type: string; + card_required: boolean; +}; + +/** @internal */ +export const PreviewMultiAttachFreeTrialParams$outboundSchema: z.ZodMiniType< + PreviewMultiAttachFreeTrialParams$Outbound, + PreviewMultiAttachFreeTrialParams +> = z.pipe( + z.object({ + durationLength: z.number(), + durationType: z._default( + PreviewMultiAttachDurationType$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 previewMultiAttachFreeTrialParamsToJSON( + previewMultiAttachFreeTrialParams: PreviewMultiAttachFreeTrialParams, +): string { + return JSON.stringify( + PreviewMultiAttachFreeTrialParams$outboundSchema.parse( + previewMultiAttachFreeTrialParams, + ), + ); +} + +/** @internal */ +export type PreviewMultiAttachInvoiceMode$Outbound = { + enabled: boolean; + enable_plan_immediately: boolean; + finalize: boolean; +}; + +/** @internal */ +export const PreviewMultiAttachInvoiceMode$outboundSchema: z.ZodMiniType< + PreviewMultiAttachInvoiceMode$Outbound, + PreviewMultiAttachInvoiceMode +> = z.pipe( + z.object({ + enabled: z.boolean(), + enablePlanImmediately: z._default(z.boolean(), false), + finalize: z._default(z.boolean(), true), + }), + z.transform((v) => { + return remap$(v, { + enablePlanImmediately: "enable_plan_immediately", + }); + }), +); + +export function previewMultiAttachInvoiceModeToJSON( + previewMultiAttachInvoiceMode: PreviewMultiAttachInvoiceMode, +): string { + return JSON.stringify( + PreviewMultiAttachInvoiceMode$outboundSchema.parse( + previewMultiAttachInvoiceMode, + ), + ); +} + +/** @internal */ +export type PreviewMultiAttachAttachDiscount$Outbound = { + reward_id?: string | undefined; + promotion_code?: string | undefined; +}; + +/** @internal */ +export const PreviewMultiAttachAttachDiscount$outboundSchema: z.ZodMiniType< + PreviewMultiAttachAttachDiscount$Outbound, + PreviewMultiAttachAttachDiscount +> = z.pipe( + z.object({ + rewardId: z.optional(z.string()), + promotionCode: z.optional(z.string()), + }), + z.transform((v) => { + return remap$(v, { + rewardId: "reward_id", + promotionCode: "promotion_code", + }); + }), +); + +export function previewMultiAttachAttachDiscountToJSON( + previewMultiAttachAttachDiscount: PreviewMultiAttachAttachDiscount, +): string { + return JSON.stringify( + PreviewMultiAttachAttachDiscount$outboundSchema.parse( + previewMultiAttachAttachDiscount, + ), + ); +} + +/** @internal */ +export const PreviewMultiAttachRedirectMode$outboundSchema: z.ZodMiniEnum< + typeof PreviewMultiAttachRedirectMode +> = z.enum(PreviewMultiAttachRedirectMode); + +/** @internal */ +export type PreviewMultiAttachEntityData$Outbound = { + feature_id: string; + name?: string | undefined; +}; + +/** @internal */ +export const PreviewMultiAttachEntityData$outboundSchema: z.ZodMiniType< + PreviewMultiAttachEntityData$Outbound, + PreviewMultiAttachEntityData +> = z.pipe( + z.object({ + featureId: z.string(), + name: z.optional(z.string()), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function previewMultiAttachEntityDataToJSON( + previewMultiAttachEntityData: PreviewMultiAttachEntityData, +): string { + return JSON.stringify( + PreviewMultiAttachEntityData$outboundSchema.parse( + previewMultiAttachEntityData, + ), + ); +} + +/** @internal */ +export type PreviewMultiAttachParams$Outbound = { + customer_id: string; + entity_id?: string | undefined; + plans: Array; + free_trial?: PreviewMultiAttachFreeTrialParams$Outbound | null | undefined; + invoice_mode?: PreviewMultiAttachInvoiceMode$Outbound | undefined; + discounts?: Array | undefined; + success_url?: string | undefined; + checkout_session_params?: { [k: string]: any } | undefined; + redirect_mode: string; + new_billing_subscription?: boolean | undefined; + customer_data?: CustomerData$Outbound | undefined; + entity_data?: PreviewMultiAttachEntityData$Outbound | undefined; +}; + +/** @internal */ +export const PreviewMultiAttachParams$outboundSchema: z.ZodMiniType< + PreviewMultiAttachParams$Outbound, + PreviewMultiAttachParams +> = z.pipe( + z.object({ + customerId: z.string(), + entityId: z.optional(z.string()), + plans: z.array(z.lazy(() => PreviewMultiAttachPlan$outboundSchema)), + freeTrial: z.optional( + z.nullable( + z.lazy(() => PreviewMultiAttachFreeTrialParams$outboundSchema), + ), + ), + invoiceMode: z.optional( + z.lazy(() => PreviewMultiAttachInvoiceMode$outboundSchema), + ), + discounts: z.optional( + z.array(z.lazy(() => PreviewMultiAttachAttachDiscount$outboundSchema)), + ), + successUrl: z.optional(z.string()), + checkoutSessionParams: z.optional(z.record(z.string(), z.any())), + redirectMode: z._default( + PreviewMultiAttachRedirectMode$outboundSchema, + "if_required", + ), + newBillingSubscription: z.optional(z.boolean()), + customerData: z.optional(CustomerData$outboundSchema), + entityData: z.optional( + z.lazy(() => PreviewMultiAttachEntityData$outboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + entityId: "entity_id", + freeTrial: "free_trial", + invoiceMode: "invoice_mode", + successUrl: "success_url", + checkoutSessionParams: "checkout_session_params", + redirectMode: "redirect_mode", + newBillingSubscription: "new_billing_subscription", + customerData: "customer_data", + entityData: "entity_data", + }); + }), +); + +export function previewMultiAttachParamsToJSON( + previewMultiAttachParams: PreviewMultiAttachParams, +): string { + return JSON.stringify( + PreviewMultiAttachParams$outboundSchema.parse(previewMultiAttachParams), + ); +} + +/** @internal */ +export const PreviewMultiAttachDiscount$inboundSchema: z.ZodMiniType< + PreviewMultiAttachDiscount, + unknown +> = z.object({ + amountOff: types.number(), + percentOff: types.optional(types.number()), + stripeCouponId: types.optional(types.string()), + couponName: types.optional(types.string()), +}); + +export function previewMultiAttachDiscountFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PreviewMultiAttachDiscount$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PreviewMultiAttachDiscount' from JSON`, + ); +} + +/** @internal */ +export const PreviewMultiAttachLineItem$inboundSchema: z.ZodMiniType< + PreviewMultiAttachLineItem, + unknown +> = z.object({ + title: types.string(), + description: types.string(), + amount: types.number(), + discounts: types.optional( + z.array(z.lazy(() => PreviewMultiAttachDiscount$inboundSchema)), + ), +}); + +export function previewMultiAttachLineItemFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PreviewMultiAttachLineItem$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PreviewMultiAttachLineItem' from JSON`, + ); +} + +/** @internal */ +export const PreviewMultiAttachNextCycle$inboundSchema: z.ZodMiniType< + PreviewMultiAttachNextCycle, + unknown +> = z.pipe( + z.object({ + starts_at: types.number(), + total: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "starts_at": "startsAt", + }); + }), +); + +export function previewMultiAttachNextCycleFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PreviewMultiAttachNextCycle$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PreviewMultiAttachNextCycle' from JSON`, + ); +} + +/** @internal */ +export const PreviewMultiAttachResponse$inboundSchema: z.ZodMiniType< + PreviewMultiAttachResponse, + unknown +> = z.pipe( + z.object({ + customer_id: types.string(), + line_items: z.array(z.lazy(() => PreviewMultiAttachLineItem$inboundSchema)), + total: types.number(), + currency: types.string(), + next_cycle: types.optional( + z.lazy(() => PreviewMultiAttachNextCycle$inboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + "customer_id": "customerId", + "line_items": "lineItems", + "next_cycle": "nextCycle", + }); + }), +); + +export function previewMultiAttachResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PreviewMultiAttachResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PreviewMultiAttachResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/preview-update-op.ts b/packages/sdk/src/models/preview-update-op.ts index a02027b29..1eb45f9e9 100644 --- a/packages/sdk/src/models/preview-update-op.ts +++ b/packages/sdk/src/models/preview-update-op.ts @@ -109,8 +109,17 @@ export type PreviewUpdateTo = number | string; export type PreviewUpdateTier = { to: number | string; amount: number; + flatAmount?: number | null | undefined; }; +export const PreviewUpdateTierBehavior = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type PreviewUpdateTierBehavior = ClosedEnum< + typeof PreviewUpdateTierBehavior +>; + /** * Billing interval. For consumable features, should match reset.interval. */ @@ -152,9 +161,10 @@ export type PreviewUpdatePrice = { */ amount?: number | undefined; /** - * Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + * Tiered pricing. Either 'amount' or 'tiers' is required. */ tiers?: Array | undefined; + tierBehavior?: PreviewUpdateTierBehavior | undefined; /** * Billing interval. For consumable features, should match reset.interval. */ @@ -618,16 +628,25 @@ export function previewUpdateToToJSON( export type PreviewUpdateTier$Outbound = { to: number | string; amount: number; + flat_amount?: number | null | undefined; }; /** @internal */ export const PreviewUpdateTier$outboundSchema: z.ZodMiniType< PreviewUpdateTier$Outbound, PreviewUpdateTier -> = z.object({ - to: smartUnion([z.number(), z.string()]), - amount: z.number(), -}); +> = z.pipe( + z.object({ + to: smartUnion([z.number(), z.string()]), + amount: z.number(), + flatAmount: z.optional(z.nullable(z.number())), + }), + z.transform((v) => { + return remap$(v, { + flatAmount: "flat_amount", + }); + }), +); export function previewUpdateTierToJSON( previewUpdateTier: PreviewUpdateTier, @@ -637,6 +656,11 @@ export function previewUpdateTierToJSON( ); } +/** @internal */ +export const PreviewUpdateTierBehavior$outboundSchema: z.ZodMiniEnum< + typeof PreviewUpdateTierBehavior +> = z.enum(PreviewUpdateTierBehavior); + /** @internal */ export const PreviewUpdateItemPriceInterval$outboundSchema: z.ZodMiniEnum< typeof PreviewUpdateItemPriceInterval @@ -651,6 +675,7 @@ export const PreviewUpdateBillingMethod$outboundSchema: z.ZodMiniEnum< export type PreviewUpdatePrice$Outbound = { amount?: number | undefined; tiers?: Array | undefined; + tier_behavior?: string | undefined; interval: string; interval_count: number; billing_units: number; @@ -666,6 +691,7 @@ export const PreviewUpdatePrice$outboundSchema: z.ZodMiniType< z.object({ amount: z.optional(z.number()), tiers: z.optional(z.array(z.lazy(() => PreviewUpdateTier$outboundSchema))), + tierBehavior: z.optional(PreviewUpdateTierBehavior$outboundSchema), interval: PreviewUpdateItemPriceInterval$outboundSchema, intervalCount: z._default(z.number(), 1), billingUnits: z._default(z.number(), 1), @@ -674,6 +700,7 @@ export const PreviewUpdatePrice$outboundSchema: z.ZodMiniType< }), z.transform((v) => { return remap$(v, { + tierBehavior: "tier_behavior", intervalCount: "interval_count", billingUnits: "billing_units", billingMethod: "billing_method", diff --git a/packages/sdk/src/models/setup-payment-op.ts b/packages/sdk/src/models/setup-payment-op.ts index 96a093bc9..667ee39c9 100644 --- a/packages/sdk/src/models/setup-payment-op.ts +++ b/packages/sdk/src/models/setup-payment-op.ts @@ -5,34 +5,415 @@ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; +import { ClosedEnum } from "../types/enums.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 { smartUnion } from "../types/smart-union.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type SetupPaymentGlobals = { xApiVersion?: string | undefined; }; +/** + * Quantity configuration for a prepaid feature. + */ +export type SetupPaymentFeatureQuantity = { + /** + * The ID of the feature to set quantity for. + */ + featureId: string; + /** + * The quantity of the feature. + */ + quantity?: number | undefined; + /** + * Whether the customer can adjust the quantity. + */ + adjustable?: boolean | undefined; +}; + +/** + * Billing interval (e.g. 'month', 'year'). + */ +export const SetupPaymentPriceInterval = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Billing interval (e.g. 'month', 'year'). + */ +export type SetupPaymentPriceInterval = ClosedEnum< + typeof SetupPaymentPriceInterval +>; + +/** + * Base price configuration for a plan. + */ +export type SetupPaymentBasePrice = { + /** + * Base price amount for the plan. + */ + amount: number; + /** + * Billing interval (e.g. 'month', 'year'). + */ + interval: SetupPaymentPriceInterval; + /** + * 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 SetupPaymentResetInterval = { + 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 SetupPaymentResetInterval = ClosedEnum< + typeof SetupPaymentResetInterval +>; + +/** + * Reset configuration for consumable features. Omit for non-consumable features like seats. + */ +export type SetupPaymentReset = { + /** + * Interval at which balance resets (e.g. 'month', 'year'). For consumable features only. + */ + interval: SetupPaymentResetInterval; + /** + * Number of intervals between resets. Defaults to 1. + */ + intervalCount?: number | undefined; +}; + +export type SetupPaymentTo = number | string; + +export type SetupPaymentTier = { + to: number | string; + amount: number; + flatAmount?: number | null | undefined; +}; + +export const SetupPaymentTierBehavior = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type SetupPaymentTierBehavior = ClosedEnum< + typeof SetupPaymentTierBehavior +>; + +/** + * Billing interval. For consumable features, should match reset.interval. + */ +export const SetupPaymentItemPriceInterval = { + 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 SetupPaymentItemPriceInterval = ClosedEnum< + typeof SetupPaymentItemPriceInterval +>; + +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ +export const SetupPaymentBillingMethod = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +/** + * 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go. + */ +export type SetupPaymentBillingMethod = ClosedEnum< + typeof SetupPaymentBillingMethod +>; + +/** + * Pricing for usage beyond included units. Omit for free features. + */ +export type SetupPaymentPrice = { + /** + * Price per billing_units after included usage. Either 'amount' or 'tiers' is required. + */ + amount?: number | undefined; + /** + * Tiered pricing. Either 'amount' or 'tiers' is required. + */ + tiers?: Array | undefined; + tierBehavior?: SetupPaymentTierBehavior | undefined; + /** + * Billing interval. For consumable features, should match reset.interval. + */ + interval: SetupPaymentItemPriceInterval; + /** + * 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: SetupPaymentBillingMethod; + /** + * 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 SetupPaymentOnIncrease = { + 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 SetupPaymentOnIncrease = ClosedEnum; + +/** + * Credit behavior when quantity decreases mid-cycle. + */ +export const SetupPaymentOnDecrease = { + 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 SetupPaymentOnDecrease = ClosedEnum; + +/** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ +export type SetupPaymentProration = { + /** + * Billing behavior when quantity increases mid-cycle. + */ + onIncrease: SetupPaymentOnIncrease; + /** + * Credit behavior when quantity decreases mid-cycle. + */ + onDecrease: SetupPaymentOnDecrease; +}; + +/** + * When rolled over units expire. + */ +export const SetupPaymentExpiryDurationType = { + Month: "month", + Forever: "forever", +} as const; +/** + * When rolled over units expire. + */ +export type SetupPaymentExpiryDurationType = ClosedEnum< + typeof SetupPaymentExpiryDurationType +>; + +/** + * Rollover config for unused units. If set, unused included units carry over. + */ +export type SetupPaymentRollover = { + /** + * Max rollover units. Omit for unlimited rollover. + */ + max?: number | undefined; + /** + * When rolled over units expire. + */ + expiryDurationType: SetupPaymentExpiryDurationType; + /** + * Number of periods before expiry. + */ + expiryDurationLength?: number | undefined; +}; + +/** + * Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings. + */ +export type SetupPaymentPlanItem = { + /** + * 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?: SetupPaymentReset | undefined; + /** + * Pricing for usage beyond included units. Omit for free features. + */ + price?: SetupPaymentPrice | undefined; + /** + * Proration settings for prepaid features. Controls mid-cycle quantity change billing. + */ + proration?: SetupPaymentProration | undefined; + /** + * Rollover config for unused units. If set, unused included units carry over. + */ + rollover?: SetupPaymentRollover | undefined; +}; + +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ +export const SetupPaymentDurationType = { + Day: "day", + Month: "month", + Year: "year", +} as const; +/** + * Unit of time for the trial ('day', 'month', 'year'). + */ +export type SetupPaymentDurationType = ClosedEnum< + typeof SetupPaymentDurationType +>; + +/** + * Free trial configuration for a plan. + */ +export type SetupPaymentFreeTrialParams = { + /** + * Number of duration_type periods the trial lasts. + */ + durationLength: number; + /** + * Unit of time for the trial ('day', 'month', 'year'). + */ + durationType?: SetupPaymentDurationType | undefined; + /** + * If true, payment method required to start trial. Customer is charged after trial ends. + */ + cardRequired?: boolean | undefined; +}; + +/** + * Customize the plan to attach. Can override the price, items, free trial, or a combination. + */ +export type SetupPaymentCustomize = { + /** + * Override the base price of the plan. Pass null to remove the base price. + */ + price?: SetupPaymentBasePrice | null | undefined; + /** + * Override the items in the plan. + */ + items?: Array | undefined; + /** + * Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. + */ + freeTrial?: SetupPaymentFreeTrialParams | null | undefined; +}; + +/** + * How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. + */ +export const SetupPaymentProrationBehavior = { + ProrateImmediately: "prorate_immediately", + None: "none", +} as const; +/** + * How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. + */ +export type SetupPaymentProrationBehavior = ClosedEnum< + typeof SetupPaymentProrationBehavior +>; + +/** + * A discount to apply. Can be either a reward ID or a promotion code. + */ +export type SetupPaymentAttachDiscount = { + /** + * The ID of the reward to apply as a discount. + */ + rewardId?: string | undefined; + /** + * The promotion code to apply as a discount. + */ + promotionCode?: string | undefined; +}; + export type SetupPaymentParams = { /** - * The ID of the customer + * The ID of the customer to attach the plan to. */ customerId: string; /** - * URL to redirect to after successful payment setup. Must start with either http:// or https:// + * The ID of the entity to attach the plan to. + */ + entityId?: string | undefined; + /** + * If specified, the plan will be attached to the customer after setup. + */ + planId?: string | undefined; + /** + * If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. + */ + featureQuantities?: Array | undefined; + /** + * The version of the plan to attach. + */ + version?: number | undefined; + /** + * Customize the plan to attach. Can override the price, items, free trial, or a combination. + */ + customize?: SetupPaymentCustomize | undefined; + /** + * How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges. + */ + prorationBehavior?: SetupPaymentProrationBehavior | undefined; + /** + * List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + */ + discounts?: Array | undefined; + /** + * URL to redirect to after successful checkout. */ successUrl?: string | undefined; /** - * Customer details to set when creating a customer - */ - customerData?: CustomerData | undefined; - /** - * Additional parameters for the checkout session + * Additional parameters to pass into the creation of the Stripe checkout session. */ checkoutSessionParams?: { [k: string]: any } | undefined; }; @@ -46,16 +427,472 @@ export type SetupPaymentResponse = { */ customerId: string; /** - * URL to the payment setup page + * The ID of the entity the plan (if specified) will be attached to after setup. + */ + entityId?: string | undefined; + /** + * URL to redirect the customer to setup their payment. */ url: string; }; +/** @internal */ +export type SetupPaymentFeatureQuantity$Outbound = { + feature_id: string; + quantity?: number | undefined; + adjustable?: boolean | undefined; +}; + +/** @internal */ +export const SetupPaymentFeatureQuantity$outboundSchema: z.ZodMiniType< + SetupPaymentFeatureQuantity$Outbound, + SetupPaymentFeatureQuantity +> = z.pipe( + z.object({ + featureId: z.string(), + quantity: z.optional(z.number()), + adjustable: z.optional(z.boolean()), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function setupPaymentFeatureQuantityToJSON( + setupPaymentFeatureQuantity: SetupPaymentFeatureQuantity, +): string { + return JSON.stringify( + SetupPaymentFeatureQuantity$outboundSchema.parse( + setupPaymentFeatureQuantity, + ), + ); +} + +/** @internal */ +export const SetupPaymentPriceInterval$outboundSchema: z.ZodMiniEnum< + typeof SetupPaymentPriceInterval +> = z.enum(SetupPaymentPriceInterval); + +/** @internal */ +export type SetupPaymentBasePrice$Outbound = { + amount: number; + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const SetupPaymentBasePrice$outboundSchema: z.ZodMiniType< + SetupPaymentBasePrice$Outbound, + SetupPaymentBasePrice +> = z.pipe( + z.object({ + amount: z.number(), + interval: SetupPaymentPriceInterval$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function setupPaymentBasePriceToJSON( + setupPaymentBasePrice: SetupPaymentBasePrice, +): string { + return JSON.stringify( + SetupPaymentBasePrice$outboundSchema.parse(setupPaymentBasePrice), + ); +} + +/** @internal */ +export const SetupPaymentResetInterval$outboundSchema: z.ZodMiniEnum< + typeof SetupPaymentResetInterval +> = z.enum(SetupPaymentResetInterval); + +/** @internal */ +export type SetupPaymentReset$Outbound = { + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const SetupPaymentReset$outboundSchema: z.ZodMiniType< + SetupPaymentReset$Outbound, + SetupPaymentReset +> = z.pipe( + z.object({ + interval: SetupPaymentResetInterval$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function setupPaymentResetToJSON( + setupPaymentReset: SetupPaymentReset, +): string { + return JSON.stringify( + SetupPaymentReset$outboundSchema.parse(setupPaymentReset), + ); +} + +/** @internal */ +export type SetupPaymentTo$Outbound = number | string; + +/** @internal */ +export const SetupPaymentTo$outboundSchema: z.ZodMiniType< + SetupPaymentTo$Outbound, + SetupPaymentTo +> = smartUnion([z.number(), z.string()]); + +export function setupPaymentToToJSON(setupPaymentTo: SetupPaymentTo): string { + return JSON.stringify(SetupPaymentTo$outboundSchema.parse(setupPaymentTo)); +} + +/** @internal */ +export type SetupPaymentTier$Outbound = { + to: number | string; + amount: number; + flat_amount?: number | null | undefined; +}; + +/** @internal */ +export const SetupPaymentTier$outboundSchema: z.ZodMiniType< + SetupPaymentTier$Outbound, + SetupPaymentTier +> = z.pipe( + z.object({ + to: smartUnion([z.number(), z.string()]), + amount: z.number(), + flatAmount: z.optional(z.nullable(z.number())), + }), + z.transform((v) => { + return remap$(v, { + flatAmount: "flat_amount", + }); + }), +); + +export function setupPaymentTierToJSON( + setupPaymentTier: SetupPaymentTier, +): string { + return JSON.stringify( + SetupPaymentTier$outboundSchema.parse(setupPaymentTier), + ); +} + +/** @internal */ +export const SetupPaymentTierBehavior$outboundSchema: z.ZodMiniEnum< + typeof SetupPaymentTierBehavior +> = z.enum(SetupPaymentTierBehavior); + +/** @internal */ +export const SetupPaymentItemPriceInterval$outboundSchema: z.ZodMiniEnum< + typeof SetupPaymentItemPriceInterval +> = z.enum(SetupPaymentItemPriceInterval); + +/** @internal */ +export const SetupPaymentBillingMethod$outboundSchema: z.ZodMiniEnum< + typeof SetupPaymentBillingMethod +> = z.enum(SetupPaymentBillingMethod); + +/** @internal */ +export type SetupPaymentPrice$Outbound = { + amount?: number | undefined; + tiers?: Array | undefined; + tier_behavior?: string | undefined; + interval: string; + interval_count: number; + billing_units: number; + billing_method: string; + max_purchase?: number | undefined; +}; + +/** @internal */ +export const SetupPaymentPrice$outboundSchema: z.ZodMiniType< + SetupPaymentPrice$Outbound, + SetupPaymentPrice +> = z.pipe( + z.object({ + amount: z.optional(z.number()), + tiers: z.optional(z.array(z.lazy(() => SetupPaymentTier$outboundSchema))), + tierBehavior: z.optional(SetupPaymentTierBehavior$outboundSchema), + interval: SetupPaymentItemPriceInterval$outboundSchema, + intervalCount: z._default(z.number(), 1), + billingUnits: z._default(z.number(), 1), + billingMethod: SetupPaymentBillingMethod$outboundSchema, + maxPurchase: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + tierBehavior: "tier_behavior", + intervalCount: "interval_count", + billingUnits: "billing_units", + billingMethod: "billing_method", + maxPurchase: "max_purchase", + }); + }), +); + +export function setupPaymentPriceToJSON( + setupPaymentPrice: SetupPaymentPrice, +): string { + return JSON.stringify( + SetupPaymentPrice$outboundSchema.parse(setupPaymentPrice), + ); +} + +/** @internal */ +export const SetupPaymentOnIncrease$outboundSchema: z.ZodMiniEnum< + typeof SetupPaymentOnIncrease +> = z.enum(SetupPaymentOnIncrease); + +/** @internal */ +export const SetupPaymentOnDecrease$outboundSchema: z.ZodMiniEnum< + typeof SetupPaymentOnDecrease +> = z.enum(SetupPaymentOnDecrease); + +/** @internal */ +export type SetupPaymentProration$Outbound = { + on_increase: string; + on_decrease: string; +}; + +/** @internal */ +export const SetupPaymentProration$outboundSchema: z.ZodMiniType< + SetupPaymentProration$Outbound, + SetupPaymentProration +> = z.pipe( + z.object({ + onIncrease: SetupPaymentOnIncrease$outboundSchema, + onDecrease: SetupPaymentOnDecrease$outboundSchema, + }), + z.transform((v) => { + return remap$(v, { + onIncrease: "on_increase", + onDecrease: "on_decrease", + }); + }), +); + +export function setupPaymentProrationToJSON( + setupPaymentProration: SetupPaymentProration, +): string { + return JSON.stringify( + SetupPaymentProration$outboundSchema.parse(setupPaymentProration), + ); +} + +/** @internal */ +export const SetupPaymentExpiryDurationType$outboundSchema: z.ZodMiniEnum< + typeof SetupPaymentExpiryDurationType +> = z.enum(SetupPaymentExpiryDurationType); + +/** @internal */ +export type SetupPaymentRollover$Outbound = { + max?: number | undefined; + expiry_duration_type: string; + expiry_duration_length?: number | undefined; +}; + +/** @internal */ +export const SetupPaymentRollover$outboundSchema: z.ZodMiniType< + SetupPaymentRollover$Outbound, + SetupPaymentRollover +> = z.pipe( + z.object({ + max: z.optional(z.number()), + expiryDurationType: SetupPaymentExpiryDurationType$outboundSchema, + expiryDurationLength: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + expiryDurationType: "expiry_duration_type", + expiryDurationLength: "expiry_duration_length", + }); + }), +); + +export function setupPaymentRolloverToJSON( + setupPaymentRollover: SetupPaymentRollover, +): string { + return JSON.stringify( + SetupPaymentRollover$outboundSchema.parse(setupPaymentRollover), + ); +} + +/** @internal */ +export type SetupPaymentPlanItem$Outbound = { + feature_id: string; + included?: number | undefined; + unlimited?: boolean | undefined; + reset?: SetupPaymentReset$Outbound | undefined; + price?: SetupPaymentPrice$Outbound | undefined; + proration?: SetupPaymentProration$Outbound | undefined; + rollover?: SetupPaymentRollover$Outbound | undefined; +}; + +/** @internal */ +export const SetupPaymentPlanItem$outboundSchema: z.ZodMiniType< + SetupPaymentPlanItem$Outbound, + SetupPaymentPlanItem +> = z.pipe( + z.object({ + featureId: z.string(), + included: z.optional(z.number()), + unlimited: z.optional(z.boolean()), + reset: z.optional(z.lazy(() => SetupPaymentReset$outboundSchema)), + price: z.optional(z.lazy(() => SetupPaymentPrice$outboundSchema)), + proration: z.optional(z.lazy(() => SetupPaymentProration$outboundSchema)), + rollover: z.optional(z.lazy(() => SetupPaymentRollover$outboundSchema)), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function setupPaymentPlanItemToJSON( + setupPaymentPlanItem: SetupPaymentPlanItem, +): string { + return JSON.stringify( + SetupPaymentPlanItem$outboundSchema.parse(setupPaymentPlanItem), + ); +} + +/** @internal */ +export const SetupPaymentDurationType$outboundSchema: z.ZodMiniEnum< + typeof SetupPaymentDurationType +> = z.enum(SetupPaymentDurationType); + +/** @internal */ +export type SetupPaymentFreeTrialParams$Outbound = { + duration_length: number; + duration_type: string; + card_required: boolean; +}; + +/** @internal */ +export const SetupPaymentFreeTrialParams$outboundSchema: z.ZodMiniType< + SetupPaymentFreeTrialParams$Outbound, + SetupPaymentFreeTrialParams +> = z.pipe( + z.object({ + durationLength: z.number(), + durationType: z._default(SetupPaymentDurationType$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 setupPaymentFreeTrialParamsToJSON( + setupPaymentFreeTrialParams: SetupPaymentFreeTrialParams, +): string { + return JSON.stringify( + SetupPaymentFreeTrialParams$outboundSchema.parse( + setupPaymentFreeTrialParams, + ), + ); +} + +/** @internal */ +export type SetupPaymentCustomize$Outbound = { + price?: SetupPaymentBasePrice$Outbound | null | undefined; + items?: Array | undefined; + free_trial?: SetupPaymentFreeTrialParams$Outbound | null | undefined; +}; + +/** @internal */ +export const SetupPaymentCustomize$outboundSchema: z.ZodMiniType< + SetupPaymentCustomize$Outbound, + SetupPaymentCustomize +> = z.pipe( + z.object({ + price: z.optional( + z.nullable(z.lazy(() => SetupPaymentBasePrice$outboundSchema)), + ), + items: z.optional( + z.array(z.lazy(() => SetupPaymentPlanItem$outboundSchema)), + ), + freeTrial: z.optional( + z.nullable(z.lazy(() => SetupPaymentFreeTrialParams$outboundSchema)), + ), + }), + z.transform((v) => { + return remap$(v, { + freeTrial: "free_trial", + }); + }), +); + +export function setupPaymentCustomizeToJSON( + setupPaymentCustomize: SetupPaymentCustomize, +): string { + return JSON.stringify( + SetupPaymentCustomize$outboundSchema.parse(setupPaymentCustomize), + ); +} + +/** @internal */ +export const SetupPaymentProrationBehavior$outboundSchema: z.ZodMiniEnum< + typeof SetupPaymentProrationBehavior +> = z.enum(SetupPaymentProrationBehavior); + +/** @internal */ +export type SetupPaymentAttachDiscount$Outbound = { + reward_id?: string | undefined; + promotion_code?: string | undefined; +}; + +/** @internal */ +export const SetupPaymentAttachDiscount$outboundSchema: z.ZodMiniType< + SetupPaymentAttachDiscount$Outbound, + SetupPaymentAttachDiscount +> = z.pipe( + z.object({ + rewardId: z.optional(z.string()), + promotionCode: z.optional(z.string()), + }), + z.transform((v) => { + return remap$(v, { + rewardId: "reward_id", + promotionCode: "promotion_code", + }); + }), +); + +export function setupPaymentAttachDiscountToJSON( + setupPaymentAttachDiscount: SetupPaymentAttachDiscount, +): string { + return JSON.stringify( + SetupPaymentAttachDiscount$outboundSchema.parse(setupPaymentAttachDiscount), + ); +} + /** @internal */ export type SetupPaymentParams$Outbound = { customer_id: string; + entity_id?: string | undefined; + plan_id?: string | undefined; + feature_quantities?: Array | undefined; + version?: number | undefined; + customize?: SetupPaymentCustomize$Outbound | undefined; + proration_behavior?: string | undefined; + discounts?: Array | undefined; success_url?: string | undefined; - customer_data?: CustomerData$Outbound | undefined; checkout_session_params?: { [k: string]: any } | undefined; }; @@ -66,15 +903,28 @@ export const SetupPaymentParams$outboundSchema: z.ZodMiniType< > = z.pipe( z.object({ customerId: z.string(), + entityId: z.optional(z.string()), + planId: z.optional(z.string()), + featureQuantities: z.optional( + z.array(z.lazy(() => SetupPaymentFeatureQuantity$outboundSchema)), + ), + version: z.optional(z.number()), + customize: z.optional(z.lazy(() => SetupPaymentCustomize$outboundSchema)), + prorationBehavior: z.optional(SetupPaymentProrationBehavior$outboundSchema), + discounts: z.optional( + z.array(z.lazy(() => SetupPaymentAttachDiscount$outboundSchema)), + ), 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", + entityId: "entity_id", + planId: "plan_id", + featureQuantities: "feature_quantities", + prorationBehavior: "proration_behavior", successUrl: "success_url", - customerData: "customer_data", checkoutSessionParams: "checkout_session_params", }); }), @@ -95,11 +945,13 @@ export const SetupPaymentResponse$inboundSchema: z.ZodMiniType< > = z.pipe( z.object({ customer_id: types.string(), + entity_id: types.optional(types.string()), url: types.string(), }), z.transform((v) => { return remap$(v, { "customer_id": "customerId", + "entity_id": "entityId", }); }), ); diff --git a/packages/sdk/src/models/update-balance-op.ts b/packages/sdk/src/models/update-balance-op.ts index 038d8ec36..95459ecfa 100644 --- a/packages/sdk/src/models/update-balance-op.ts +++ b/packages/sdk/src/models/update-balance-op.ts @@ -54,6 +54,10 @@ export type UpdateBalanceParams = { * Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance. */ addToBalance?: number | undefined; + /** + * The usage amount to update. Cannot be combined with remaining or add_to_balance. + */ + usage?: number | undefined; /** * Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. */ @@ -79,6 +83,7 @@ export type UpdateBalanceParams$Outbound = { entity_id?: string | undefined; remaining?: number | undefined; add_to_balance?: number | undefined; + usage?: number | undefined; interval?: string | undefined; }; @@ -93,6 +98,7 @@ export const UpdateBalanceParams$outboundSchema: z.ZodMiniType< entityId: z.optional(z.string()), remaining: z.optional(z.number()), addToBalance: z.optional(z.number()), + usage: z.optional(z.number()), interval: z.optional(UpdateBalanceInterval$outboundSchema), }), z.transform((v) => { diff --git a/packages/sdk/src/models/update-plan-op.ts b/packages/sdk/src/models/update-plan-op.ts index 179071bc5..84f576cea 100644 --- a/packages/sdk/src/models/update-plan-op.ts +++ b/packages/sdk/src/models/update-plan-op.ts @@ -92,8 +92,17 @@ export type UpdatePlanToRequest = number | string; export type UpdatePlanTierRequest = { to: number | string; amount: number; + flatAmount?: number | null | undefined; }; +export const UpdatePlanTierBehaviorRequest = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type UpdatePlanTierBehaviorRequest = ClosedEnum< + typeof UpdatePlanTierBehaviorRequest +>; + /** * Billing interval. For consumable features, should match reset.interval. */ @@ -135,9 +144,10 @@ export type UpdatePlanPriceRequest = { */ amount?: number | undefined; /** - * Tiered pricing. Each tier's 'to' does NOT include included amount. Either 'amount' or 'tiers' is required. + * Tiered pricing. Either 'amount' or 'tiers' is required. */ tiers?: Array | undefined; + tierBehavior?: UpdatePlanTierBehaviorRequest | undefined; /** * Billing interval. For consumable features, should match reset.interval. */ @@ -499,8 +509,17 @@ export type UpdatePlanToResponse = number | string; export type UpdatePlanTierResponse = { to: number | string; amount: number; + flatAmount?: number | null | undefined; }; +export const UpdatePlanTierBehaviorResponse = { + Graduated: "graduated", + Volume: "volume", +} as const; +export type UpdatePlanTierBehaviorResponse = OpenEnum< + typeof UpdatePlanTierBehaviorResponse +>; + /** * Billing interval for this price. For consumable features, should match reset.interval. */ @@ -539,9 +558,10 @@ export type UpdatePlanItemPriceResponse = { */ amount?: number | undefined; /** - * Tiered pricing configuration. Each tier's 'up_to' does NOT include the included amount. Either 'tiers' or 'amount' is required. + * Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required. */ tiers?: Array | undefined; + tierBehavior?: UpdatePlanTierBehaviorResponse | undefined; /** * Billing interval for this price. For consumable features, should match reset.interval. */ @@ -690,6 +710,36 @@ export const UpdatePlanEnv = { */ export type UpdatePlanEnv = OpenEnum; +/** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ +export const UpdatePlanScenario = { + Scheduled: "scheduled", + Active: "active", + New: "new", + Renew: "renew", + Upgrade: "upgrade", + Downgrade: "downgrade", + Cancel: "cancel", + Expired: "expired", + PastDue: "past_due", +} as const; +/** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ +export type UpdatePlanScenario = OpenEnum; + +export type UpdatePlanCustomerEligibility = { + /** + * Whether a free trial is available for this customer. + */ + trialAvailable?: boolean | undefined; + /** + * The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade). + */ + scenario: UpdatePlanScenario; +}; + /** * A plan defines a set of features, pricing, and entitlements that can be attached to customers. */ @@ -750,6 +800,7 @@ export type UpdatePlanResponse = { * If this is a variant, the ID of the base plan it was created from. */ baseVariantId: string | null; + customerEligibility?: UpdatePlanCustomerEligibility | undefined; }; /** @internal */ @@ -845,16 +896,25 @@ export function updatePlanToRequestToJSON( export type UpdatePlanTierRequest$Outbound = { to: number | string; amount: number; + flat_amount?: number | null | undefined; }; /** @internal */ export const UpdatePlanTierRequest$outboundSchema: z.ZodMiniType< UpdatePlanTierRequest$Outbound, UpdatePlanTierRequest -> = z.object({ - to: smartUnion([z.number(), z.string()]), - amount: z.number(), -}); +> = z.pipe( + z.object({ + to: smartUnion([z.number(), z.string()]), + amount: z.number(), + flatAmount: z.optional(z.nullable(z.number())), + }), + z.transform((v) => { + return remap$(v, { + flatAmount: "flat_amount", + }); + }), +); export function updatePlanTierRequestToJSON( updatePlanTierRequest: UpdatePlanTierRequest, @@ -864,6 +924,11 @@ export function updatePlanTierRequestToJSON( ); } +/** @internal */ +export const UpdatePlanTierBehaviorRequest$outboundSchema: z.ZodMiniEnum< + typeof UpdatePlanTierBehaviorRequest +> = z.enum(UpdatePlanTierBehaviorRequest); + /** @internal */ export const UpdatePlanItemPriceIntervalRequest$outboundSchema: z.ZodMiniEnum< typeof UpdatePlanItemPriceIntervalRequest @@ -878,6 +943,7 @@ export const UpdatePlanBillingMethodRequest$outboundSchema: z.ZodMiniEnum< export type UpdatePlanPriceRequest$Outbound = { amount?: number | undefined; tiers?: Array | undefined; + tier_behavior?: string | undefined; interval: string; interval_count: number; billing_units: number; @@ -895,6 +961,7 @@ export const UpdatePlanPriceRequest$outboundSchema: z.ZodMiniType< tiers: z.optional( z.array(z.lazy(() => UpdatePlanTierRequest$outboundSchema)), ), + tierBehavior: z.optional(UpdatePlanTierBehaviorRequest$outboundSchema), interval: UpdatePlanItemPriceIntervalRequest$outboundSchema, intervalCount: z._default(z.number(), 1), billingUnits: z._default(z.number(), 1), @@ -903,6 +970,7 @@ export const UpdatePlanPriceRequest$outboundSchema: z.ZodMiniType< }), z.transform((v) => { return remap$(v, { + tierBehavior: "tier_behavior", intervalCount: "interval_count", billingUnits: "billing_units", billingMethod: "billing_method", @@ -1339,10 +1407,18 @@ export function updatePlanToResponseFromJSON( export const UpdatePlanTierResponse$inboundSchema: z.ZodMiniType< UpdatePlanTierResponse, unknown -> = z.object({ - to: smartUnion([types.number(), types.string()]), - amount: types.number(), -}); +> = z.pipe( + z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), + flat_amount: z.optional(z.nullable(types.number())), + }), + z.transform((v) => { + return remap$(v, { + "flat_amount": "flatAmount", + }); + }), +); export function updatePlanTierResponseFromJSON( jsonString: string, @@ -1354,6 +1430,12 @@ export function updatePlanTierResponseFromJSON( ); } +/** @internal */ +export const UpdatePlanTierBehaviorResponse$inboundSchema: z.ZodMiniType< + UpdatePlanTierBehaviorResponse, + unknown +> = openEnums.inboundSchema(UpdatePlanTierBehaviorResponse); + /** @internal */ export const UpdatePlanPriceItemIntervalResponse$inboundSchema: z.ZodMiniType< UpdatePlanPriceItemIntervalResponse, @@ -1376,6 +1458,7 @@ export const UpdatePlanItemPriceResponse$inboundSchema: z.ZodMiniType< tiers: types.optional( z.array(z.lazy(() => UpdatePlanTierResponse$inboundSchema)), ), + tier_behavior: types.optional(UpdatePlanTierBehaviorResponse$inboundSchema), interval: UpdatePlanPriceItemIntervalResponse$inboundSchema, interval_count: types.optional(types.number()), billing_units: types.number(), @@ -1384,6 +1467,7 @@ export const UpdatePlanItemPriceResponse$inboundSchema: z.ZodMiniType< }), z.transform((v) => { return remap$(v, { + "tier_behavior": "tierBehavior", "interval_count": "intervalCount", "billing_units": "billingUnits", "billing_method": "billingMethod", @@ -1540,6 +1624,38 @@ export const UpdatePlanEnv$inboundSchema: z.ZodMiniType< unknown > = openEnums.inboundSchema(UpdatePlanEnv); +/** @internal */ +export const UpdatePlanScenario$inboundSchema: z.ZodMiniType< + UpdatePlanScenario, + unknown +> = openEnums.inboundSchema(UpdatePlanScenario); + +/** @internal */ +export const UpdatePlanCustomerEligibility$inboundSchema: z.ZodMiniType< + UpdatePlanCustomerEligibility, + unknown +> = z.pipe( + z.object({ + trial_available: types.optional(types.boolean()), + scenario: UpdatePlanScenario$inboundSchema, + }), + z.transform((v) => { + return remap$(v, { + "trial_available": "trialAvailable", + }); + }), +); + +export function updatePlanCustomerEligibilityFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdatePlanCustomerEligibility$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdatePlanCustomerEligibility' from JSON`, + ); +} + /** @internal */ export const UpdatePlanResponse$inboundSchema: z.ZodMiniType< UpdatePlanResponse, @@ -1560,6 +1676,9 @@ export const UpdatePlanResponse$inboundSchema: z.ZodMiniType< env: UpdatePlanEnv$inboundSchema, archived: types.boolean(), base_variant_id: types.nullable(types.string()), + customer_eligibility: types.optional( + z.lazy(() => UpdatePlanCustomerEligibility$inboundSchema), + ), }), z.transform((v) => { return remap$(v, { @@ -1568,6 +1687,7 @@ export const UpdatePlanResponse$inboundSchema: z.ZodMiniType< "free_trial": "freeTrial", "created_at": "createdAt", "base_variant_id": "baseVariantId", + "customer_eligibility": "customerEligibility", }); }), ); diff --git a/packages/sdk/src/sdk/billing.ts b/packages/sdk/src/sdk/billing.ts index ca679c2d4..c810caa5f 100644 --- a/packages/sdk/src/sdk/billing.ts +++ b/packages/sdk/src/sdk/billing.ts @@ -3,8 +3,10 @@ */ import { billingAttach } from "../funcs/billing-attach.js"; +import { billingMultiAttach } from "../funcs/billing-multi-attach.js"; import { billingOpenCustomerPortal } from "../funcs/billing-open-customer-portal.js"; import { billingPreviewAttach } from "../funcs/billing-preview-attach.js"; +import { billingPreviewMultiAttach } from "../funcs/billing-preview-multi-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"; @@ -48,13 +50,14 @@ export class Billing extends ClientSDK { * @param successUrl - URL to redirect to after successful checkout. (optional) * @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) * @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + * @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) * * @returns A billing response with customer ID, invoice details, and payment URL (if checkout required). */ async attach( request: models.AttachParams, options?: RequestOptions, - ): Promise { + ): Promise { return unwrapAsync(billingAttach( this, request, @@ -62,6 +65,53 @@ export class Billing extends ClientSDK { )); } + /** + * Attaches multiple plans to a customer in a single request. Creates a single Stripe subscription with all plans consolidated. + * + * Use this endpoint when you need to subscribe a customer to multiple plans at once, such as a base plan plus add-ons, or to create a bundle of products. + * + * @example + * ```typescript + * // Attach multiple plans to a customer + * const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_seats","featureQuantities":[{"featureId":"seats","quantity":5}]}] }); + * ``` + * + * @example + * ```typescript + * // Attach with free trial applied to all plans + * const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_storage"}], freeTrial: {"durationLength":14,"durationType":"day"} }); + * ``` + * + * @example + * ```typescript + * // Attach with custom pricing on one plan + * const response = await client.billing.multiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan","customize":{"price":{"amount":4900,"interval":"month"}}},{"planId":"addon_support"}] }); + * ``` + * + * @param customerId - The ID of the customer to attach the plans to. + * @param entityId - The ID of the entity to attach the plans to. (optional) + * @param plans - The list of plans to attach to the customer. + * @param freeTrial - Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. (optional) + * @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. (optional) + * @param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) + * @param successUrl - URL to redirect to after successful checkout. (optional) + * @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) + * @param redirectMode - Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. (optional) + * @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) + * + * @returns A billing response with customer ID, invoice details, and payment URL (if checkout required). + */ + async multiAttach( + request: models.MultiAttachParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(billingMultiAttach( + this, + request, + options, + )); + } + /** * Previews the billing changes that would occur when attaching a plan, without actually making any changes. * @@ -85,6 +135,7 @@ export class Billing extends ClientSDK { * @param successUrl - URL to redirect to after successful checkout. (optional) * @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) * @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + * @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) * * @returns A preview response with line items, totals, and effective dates for the proposed changes. */ @@ -99,6 +150,41 @@ export class Billing extends ClientSDK { )); } + /** + * Previews the billing changes that would occur when attaching multiple plans, without actually making any changes. + * + * Use this endpoint to show customers what they will be charged before confirming a multi-plan subscription. + * + * @example + * ```typescript + * // Preview attaching multiple plans + * const response = await client.billing.previewMultiAttach({ customerId: "cus_123", plans: [{"planId":"pro_plan"},{"planId":"addon_seats","featureQuantities":[{"featureId":"seats","quantity":5}]}] }); + * ``` + * + * @param customerId - The ID of the customer to attach the plans to. + * @param entityId - The ID of the entity to attach the plans to. (optional) + * @param plans - The list of plans to attach to the customer. + * @param freeTrial - Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial. (optional) + * @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. (optional) + * @param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) + * @param successUrl - URL to redirect to after successful checkout. (optional) + * @param checkoutSessionParams - Additional parameters to pass into the creation of the Stripe checkout session. (optional) + * @param redirectMode - Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects. (optional) + * @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) + * + * @returns A preview response with line items, totals, and effective dates for the proposed multi-plan attachment. + */ + async previewMultiAttach( + request: models.PreviewMultiAttachParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(billingPreviewMultiAttach( + this, + request, + options, + )); + } + /** * Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. * diff --git a/prepaid-volume.md b/prepaid-volume.md deleted file mode 100644 index f9b2ff41c..000000000 --- a/prepaid-volume.md +++ /dev/null @@ -1,22 +0,0 @@ -```bash -bun test:integration \ - server/tests/unit/billing/invoicing/line-item-utils/volume-tiers-to-line-amount.test.ts \ - server/tests/unit/billing/invoicing/line-item-utils/tiers-to-line-amount.test.ts \ - server/tests/integration/billing/attach/new-plan/attach-prepaid-volume.test.ts \ - server/tests/integration/billing/attach/new-plan/attach-prepaid-volume-entities.test.ts \ - server/tests/integration/billing/attach/new-plan/new-prepaid.test.ts \ - server/tests/integration/billing/attach/immediate-switch/immediate-switch-prepaid-volume.test.ts \ - server/tests/integration/billing/attach/immediate-switch/immediate-switch-entities-prepaid-volume.test.ts \ - server/tests/integration/billing/attach/scheduled-switch/scheduled-switch-prepaid-volume.test.ts \ - server/tests/integration/billing/attach/edge-cases/v1-v2-compatibility/prepaid/attach-prepaid-volume-edge-cases.test.ts \ - server/tests/integration/billing/attach/checkout/stripe-checkout/stripe-checkout-prepaid.test.ts \ - server/tests/integration/billing/update-subscription/update-quantity/volume-tiers-update-quantity.test.ts \ - server/tests/integration/billing/update-subscription/custom-plan/update-paid-tier-behavior.test.ts \ - server/tests/integration/billing/legacy/attach/new/legacy-new-volume.test.ts \ - server/tests/integration/crud/plans/create-plan-advanced.test.ts \ - server/tests/integration/crud/plans/get-plan-advanced.test.ts \ - server/tests/integration/balances/check/check-prepaid.test.ts \ - server/tests/integration/balances/check/check-balance-price.test.ts \ - server/tests/integration/billing/attach/v2-params/v2-customize.test.ts \ - --timeout 0 -``` diff --git a/server/src/internal/products/handlers/handleListPlans/handleListPlansV2.ts b/server/src/internal/products/handlers/handleListPlans/handleListPlansV2.ts index de3c40ca6..c665c1149 100644 --- a/server/src/internal/products/handlers/handleListPlans/handleListPlansV2.ts +++ b/server/src/internal/products/handlers/handleListPlans/handleListPlansV2.ts @@ -20,6 +20,8 @@ export const handleListPlansV2 = createRoute({ const startedAt = Date.now(); + console.log("Customer ID:", customer_id); + const [products, customer] = await Promise.all([ ProductService.listFull({ db, @@ -56,6 +58,7 @@ export const handleListPlansV2 = createRoute({ } const plansList = await Promise.all(batchResponse); + const res = plansList.map((p) => { return applyResponseVersionChanges({ input: p, diff --git a/server/src/internal/products/prices/priceUtils.ts b/server/src/internal/products/prices/priceUtils.ts index 27f702705..b0100a1f5 100644 --- a/server/src/internal/products/prices/priceUtils.ts +++ b/server/src/internal/products/prices/priceUtils.ts @@ -13,7 +13,6 @@ import { type Price, PriceType, type Product, - TierInfinite, type UsagePriceConfig, } from "@autumn/shared"; import RecaseError from "@server/utils/errorUtils.js"; @@ -230,63 +229,6 @@ export const getPriceOptions = ( return options; }; -const pricesAreSame = (price1: Price, price2: Price) => { - for (const key in price1.config) { - const originalValue = (price1.config as any)[key]; - const newValue = (price2.config as any)[key]; - - if (key === "usage_tiers") { - for (let i = 0; i < originalValue.length; i++) { - const originalTier = originalValue[i]; - const newTier = newValue[i]; - if (!compareObjects(originalTier, newTier)) { - return false; - } - } - } else if (originalValue !== newValue) { - return false; - } - } - - return true; -}; - -const getUsageTier = (price: Price, quantity: number) => { - const usageConfig = price.config as UsagePriceConfig; - for (let i = 0; i < usageConfig.usage_tiers.length; i++) { - if (i === usageConfig.usage_tiers.length - 1) { - return usageConfig.usage_tiers[i]; - } - - const tier = usageConfig.usage_tiers[i]; - if (tier.to === TierInfinite || tier.to >= quantity) { - return tier; - } - } - return usageConfig.usage_tiers[0]; -}; - -const priceToEventName = (productName: string, featureName: string) => { - return `${productName} - ${featureName}`; -}; - -const roundPriceAmounts = (price: Price) => { - if (price.config!.type === PriceType.Fixed) { - const config = price.config as FixedPriceConfig; - config.amount = Number(config.amount.toFixed(10)); - price.config = config; - } else if (price.config!.type === PriceType.Usage) { - const config = price.config as UsagePriceConfig; - for (let i = 0; i < config.usage_tiers.length; i++) { - config.usage_tiers[i].amount = Number( - config.usage_tiers[i].amount.toFixed(10), - ); - } - - price.config = config; - } -}; - export const priceIsOneOffAndTiered = ( price: Price, relatedEnt: EntitlementWithFeature, diff --git a/shared/api/products/apiPlanV1.ts b/shared/api/products/apiPlanV1.ts index 26b45ecd0..e4efd4020 100644 --- a/shared/api/products/apiPlanV1.ts +++ b/shared/api/products/apiPlanV1.ts @@ -116,10 +116,7 @@ export const ApiPlanV1Schema = z.object({ "The attach scenario for this customer (e.g. new_subscription, upgrade, downgrade).", }), }) - .optional() - .meta({ - internal: true, - }), + .optional(), }); export type ApiPlanV1 = z.infer;