autumn-js
Version:
Autumn JS Library
1,257 lines (1,254 loc) • 40 kB
text/typescript
import { O as OpenEnum } from './plan-CUExbmy9.mjs';
/**
* Billing interval (e.g. 'month', 'year').
*/
declare const ListPlansPriceInterval: {
readonly OneOff: "one_off";
readonly Week: "week";
readonly Month: "month";
readonly Quarter: "quarter";
readonly SemiAnnual: "semi_annual";
readonly Year: "year";
};
/**
* Billing interval (e.g. 'month', 'year').
*/
type ListPlansPriceInterval = OpenEnum<typeof ListPlansPriceInterval>;
/**
* Display text for showing this price in pricing pages.
*/
type ListPlansPriceDisplay = {
/**
* Main display text (e.g. '$10' or '100 messages').
*/
primaryText: string;
/**
* Secondary display text (e.g. 'per month' or 'then $0.5 per 100').
*/
secondaryText?: string | undefined;
};
type ListPlansPrice = {
/**
* Base price amount for the plan.
*/
amount: number;
/**
* Billing interval (e.g. 'month', 'year').
*/
interval: ListPlansPriceInterval;
/**
* Number of intervals per billing cycle. Defaults to 1.
*/
intervalCount?: number | undefined;
/**
* Display text for showing this price in pricing pages.
*/
display?: ListPlansPriceDisplay | undefined;
};
/**
* The type of the feature
*/
declare const ListPlansType: {
readonly Static: "static";
readonly Boolean: "boolean";
readonly SingleUse: "single_use";
readonly ContinuousUse: "continuous_use";
readonly CreditSystem: "credit_system";
readonly AiCreditSystem: "ai_credit_system";
};
/**
* The type of the feature
*/
type ListPlansType = OpenEnum<typeof ListPlansType>;
type ListPlansFeatureDisplay = {
/**
* The singular display name for the feature.
*/
singular: string;
/**
* The plural display name for the feature.
*/
plural: string;
};
type ListPlansCreditSchema = {
/**
* The ID of the metered feature (should be a single_use feature).
*/
meteredFeatureId: string;
/**
* The credit cost of the metered feature.
*/
creditCost: number;
};
/**
* The full feature object if expanded.
*/
type ListPlansFeature = {
/**
* The ID of the feature, used to refer to it in other API calls like /track or /check.
*/
id: string;
/**
* The name of the feature.
*/
name?: string | null | undefined;
/**
* The type of the feature
*/
type: ListPlansType;
/**
* Singular and plural display names for the feature.
*/
display?: ListPlansFeatureDisplay | null | undefined;
/**
* Credit cost schema for credit system features.
*/
creditSchema?: Array<ListPlansCreditSchema> | null | undefined;
/**
* Whether or not the feature is archived.
*/
archived?: boolean | null | undefined;
};
/**
* The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.
*/
declare const ListPlansResetItemInterval: {
readonly OneOff: "one_off";
readonly Minute: "minute";
readonly Hour: "hour";
readonly Day: "day";
readonly Week: "week";
readonly Month: "month";
readonly Quarter: "quarter";
readonly SemiAnnual: "semi_annual";
readonly Year: "year";
};
/**
* The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.
*/
type ListPlansResetItemInterval = OpenEnum<typeof ListPlansResetItemInterval>;
type ListPlansItemReset = {
/**
* The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.
*/
interval: ListPlansResetItemInterval;
/**
* Number of intervals between resets. Defaults to 1.
*/
intervalCount?: number | undefined;
};
type ListPlansItemTier = {
to: number | string;
amount: number;
flatAmount?: number | undefined;
};
declare const ListPlansItemTierBehavior: {
readonly Graduated: "graduated";
readonly Volume: "volume";
};
type ListPlansItemTierBehavior = OpenEnum<typeof ListPlansItemTierBehavior>;
/**
* Billing interval for this price. For consumable features, should match reset.interval.
*/
declare const ListPlansPriceItemInterval: {
readonly OneOff: "one_off";
readonly Week: "week";
readonly Month: "month";
readonly Quarter: "quarter";
readonly SemiAnnual: "semi_annual";
readonly Year: "year";
};
/**
* Billing interval for this price. For consumable features, should match reset.interval.
*/
type ListPlansPriceItemInterval = OpenEnum<typeof ListPlansPriceItemInterval>;
/**
* 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.
*/
declare const ListPlansItemBillingMethod: {
readonly Prepaid: "prepaid";
readonly UsageBased: "usage_based";
};
/**
* 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.
*/
type ListPlansItemBillingMethod = OpenEnum<typeof ListPlansItemBillingMethod>;
type ListPlansItemPrice = {
/**
* Price per billing_units after included usage is consumed. Mutually exclusive with tiers.
*/
amount?: number | undefined;
/**
* Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.
*/
tiers?: Array<ListPlansItemTier> | undefined;
tierBehavior?: ListPlansItemTierBehavior | undefined;
/**
* Billing interval for this price. For consumable features, should match reset.interval.
*/
interval: ListPlansPriceItemInterval;
/**
* Number of intervals per billing cycle. Defaults to 1.
*/
intervalCount?: number | undefined;
/**
* Number of units per price increment. Usage is rounded UP to the nearest billing_units when billed (e.g. billing_units=100 means 101 usage rounds to 200).
*/
billingUnits: number;
/**
* 'prepaid' for features like seats where customers pay upfront, 'usage_based' for pay-as-you-go after included usage.
*/
billingMethod: ListPlansItemBillingMethod;
/**
* Maximum units a customer can purchase beyond included. E.g. if included=100 and max_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.
*/
maxPurchase: number | null;
};
/**
* Display text for showing this item in pricing pages.
*/
type ListPlansItemDisplay = {
/**
* Main display text (e.g. '$10' or '100 messages').
*/
primaryText: string;
/**
* Secondary display text (e.g. 'per month' or 'then $0.5 per 100').
*/
secondaryText?: string | undefined;
};
/**
* When rolled over units expire.
*/
declare const ListPlansItemExpiryDurationType: {
readonly Month: "month";
readonly Forever: "forever";
};
/**
* When rolled over units expire.
*/
type ListPlansItemExpiryDurationType = OpenEnum<typeof ListPlansItemExpiryDurationType>;
/**
* Rollover configuration for unused units. If set, unused included units roll over to the next period.
*/
type ListPlansItemRollover = {
/**
* Maximum rollover units. Null for unlimited rollover.
*/
max: number | null;
/**
* Maximum rollover as a percentage (0-100) of included + prepaid grant. Mutually exclusive with max.
*/
maxPercentage?: number | null | undefined;
/**
* When rolled over units expire.
*/
expiryDurationType: ListPlansItemExpiryDurationType;
/**
* Number of periods before expiry.
*/
expiryDurationLength?: number | undefined;
};
type ListPlansItem = {
/**
* The ID of the feature this item configures.
*/
featureId: string;
/**
* The full feature object if expanded.
*/
feature?: ListPlansFeature | undefined;
/**
* Number of free units included. For consumable features, balance resets to this number each interval.
*/
included: number;
/**
* Whether the customer has unlimited access to this feature.
*/
unlimited: boolean;
/**
* Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.
*/
reset: ListPlansItemReset | null;
/**
* Pricing configuration for usage beyond included units. Null if feature is entirely free.
*/
price: ListPlansItemPrice | null;
/**
* Display text for showing this item in pricing pages.
*/
display?: ListPlansItemDisplay | undefined;
/**
* Rollover configuration for unused units. If set, unused included units roll over to the next period.
*/
rollover?: ListPlansItemRollover | undefined;
};
/**
* Unit of time for the trial duration ('day', 'month', 'year').
*/
declare const ListPlansDurationType: {
readonly Day: "day";
readonly Month: "month";
readonly Year: "year";
};
/**
* Unit of time for the trial duration ('day', 'month', 'year').
*/
type ListPlansDurationType = OpenEnum<typeof ListPlansDurationType>;
declare const ListPlansOnEnd: {
readonly Bill: "bill";
readonly Revert: "revert";
};
type ListPlansOnEnd = OpenEnum<typeof ListPlansOnEnd>;
/**
* Free trial configuration. If set, new customers can try this plan before being charged.
*/
type ListPlansFreeTrial = {
/**
* Number of duration_type periods the trial lasts.
*/
durationLength: number;
/**
* Unit of time for the trial duration ('day', 'month', 'year').
*/
durationType: ListPlansDurationType;
/**
* Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.
*/
cardRequired: boolean;
/**
* Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
*/
onEnd?: ListPlansOnEnd | null | undefined;
};
/**
* Environment this plan belongs to ('sandbox' or 'live').
*/
declare const ListPlansEnv: {
readonly Sandbox: "sandbox";
readonly Live: "live";
};
/**
* Environment this plan belongs to ('sandbox' or 'live').
*/
type ListPlansEnv = OpenEnum<typeof ListPlansEnv>;
/**
* Billing interval (e.g. 'month', 'year').
*/
declare const ListPlansPriceVariantDetailsInterval: {
readonly OneOff: "one_off";
readonly Week: "week";
readonly Month: "month";
readonly Quarter: "quarter";
readonly SemiAnnual: "semi_annual";
readonly Year: "year";
};
/**
* Billing interval (e.g. 'month', 'year').
*/
type ListPlansPriceVariantDetailsInterval = OpenEnum<typeof ListPlansPriceVariantDetailsInterval>;
/**
* Base price configuration for a plan.
*/
type ListPlansBasePrice = {
/**
* Base price amount for the plan.
*/
amount: number;
/**
* Billing interval (e.g. 'month', 'year').
*/
interval: ListPlansPriceVariantDetailsInterval;
/**
* 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.
*/
declare const ListPlansAddItemResetInterval: {
readonly OneOff: "one_off";
readonly Minute: "minute";
readonly Hour: "hour";
readonly Day: "day";
readonly Week: "week";
readonly Month: "month";
readonly Quarter: "quarter";
readonly SemiAnnual: "semi_annual";
readonly Year: "year";
};
/**
* Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.
*/
type ListPlansAddItemResetInterval = OpenEnum<typeof ListPlansAddItemResetInterval>;
/**
* Reset configuration for consumable features. Omit for non-consumable features like seats.
*/
type ListPlansVariantDetailsReset = {
/**
* Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.
*/
interval: ListPlansAddItemResetInterval;
/**
* Number of intervals between resets. Defaults to 1.
*/
intervalCount?: number | undefined;
};
type ListPlansVariantDetailsTier = {
to?: any | undefined;
amount: number;
flatAmount?: number | undefined;
};
declare const ListPlansVariantDetailsTierBehavior: {
readonly Graduated: "graduated";
readonly Volume: "volume";
};
type ListPlansVariantDetailsTierBehavior = OpenEnum<typeof ListPlansVariantDetailsTierBehavior>;
/**
* Billing interval. For consumable features, should match reset.interval.
*/
declare const ListPlansAddItemPriceInterval: {
readonly OneOff: "one_off";
readonly Week: "week";
readonly Month: "month";
readonly Quarter: "quarter";
readonly SemiAnnual: "semi_annual";
readonly Year: "year";
};
/**
* Billing interval. For consumable features, should match reset.interval.
*/
type ListPlansAddItemPriceInterval = OpenEnum<typeof ListPlansAddItemPriceInterval>;
/**
* 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.
*/
declare const ListPlansAddItemBillingMethod: {
readonly Prepaid: "prepaid";
readonly UsageBased: "usage_based";
};
/**
* 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.
*/
type ListPlansAddItemBillingMethod = OpenEnum<typeof ListPlansAddItemBillingMethod>;
/**
* Pricing for usage beyond included units. Omit for free features.
*/
type ListPlansVariantDetailsPrice = {
/**
* 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<ListPlansVariantDetailsTier> | undefined;
tierBehavior?: ListPlansVariantDetailsTierBehavior | undefined;
/**
* Billing interval. For consumable features, should match reset.interval.
*/
interval: ListPlansAddItemPriceInterval;
/**
* Number of intervals per billing cycle. Defaults to 1.
*/
intervalCount: number;
/**
* Units per price increment. Usage is rounded UP when billed (e.g. billing_units=100 means 101 rounds to 200).
*/
billingUnits: number;
/**
* 'prepaid' for upfront payment (seats), 'usage_based' for pay-as-you-go.
*/
billingMethod: ListPlansAddItemBillingMethod;
/**
* Max units purchasable beyond included. E.g. included=100, max_purchase=300 allows 400 total. Null for no limit.
*/
maxPurchase?: number | null | undefined;
};
/**
* Billing behavior when quantity increases mid-cycle.
*/
declare const ListPlansOnIncrease: {
readonly BillImmediately: "bill_immediately";
readonly ProrateImmediately: "prorate_immediately";
readonly ProrateNextCycle: "prorate_next_cycle";
readonly BillNextCycle: "bill_next_cycle";
};
/**
* Billing behavior when quantity increases mid-cycle.
*/
type ListPlansOnIncrease = OpenEnum<typeof ListPlansOnIncrease>;
/**
* Credit behavior when quantity decreases mid-cycle.
*/
declare const ListPlansOnDecrease: {
readonly Prorate: "prorate";
readonly ProrateImmediately: "prorate_immediately";
readonly ProrateNextCycle: "prorate_next_cycle";
readonly None: "none";
readonly NoProrations: "no_prorations";
};
/**
* Credit behavior when quantity decreases mid-cycle.
*/
type ListPlansOnDecrease = OpenEnum<typeof ListPlansOnDecrease>;
/**
* Proration settings for prepaid features. Controls mid-cycle quantity change billing.
*/
type ListPlansProration = {
/**
* Billing behavior when quantity increases mid-cycle.
*/
onIncrease: ListPlansOnIncrease;
/**
* Credit behavior when quantity decreases mid-cycle.
*/
onDecrease: ListPlansOnDecrease;
};
/**
* When rolled over units expire.
*/
declare const ListPlansVariantDetailsExpiryDurationType: {
readonly Month: "month";
readonly Forever: "forever";
};
/**
* When rolled over units expire.
*/
type ListPlansVariantDetailsExpiryDurationType = OpenEnum<typeof ListPlansVariantDetailsExpiryDurationType>;
/**
* Rollover config for unused units. If set, unused included units carry over.
*/
type ListPlansVariantDetailsRollover = {
/**
* Max rollover units. Omit for unlimited rollover.
*/
max?: number | undefined;
/**
* Maximum rollover as a percentage (0-100) of included + prepaid grant. Mutually exclusive with max.
*/
maxPercentage?: number | undefined;
/**
* When rolled over units expire.
*/
expiryDurationType: ListPlansVariantDetailsExpiryDurationType;
/**
* Number of periods before expiry.
*/
expiryDurationLength?: number | undefined;
};
/**
* Configuration for a feature item in a plan, including usage limits, pricing, and rollover settings.
*/
type ListPlansPlanItem = {
/**
* 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?: ListPlansVariantDetailsReset | undefined;
/**
* Pricing for usage beyond included units. Omit for free features.
*/
price?: ListPlansVariantDetailsPrice | undefined;
/**
* Proration settings for prepaid features. Controls mid-cycle quantity change billing.
*/
proration?: ListPlansProration | undefined;
/**
* Rollover config for unused units. If set, unused included units carry over.
*/
rollover?: ListPlansVariantDetailsRollover | undefined;
};
/**
* Match items with this billing method (prepaid or usage_based).
*/
declare const ListPlansRemoveItemBillingMethod: {
readonly Prepaid: "prepaid";
readonly UsageBased: "usage_based";
};
/**
* Match items with this billing method (prepaid or usage_based).
*/
type ListPlansRemoveItemBillingMethod = OpenEnum<typeof ListPlansRemoveItemBillingMethod>;
declare const ListPlansIntervalRemoveItemEnum2: {
readonly OneOff: "one_off";
readonly Minute: "minute";
readonly Hour: "hour";
readonly Day: "day";
readonly Week: "week";
readonly Month: "month";
readonly Quarter: "quarter";
readonly SemiAnnual: "semi_annual";
readonly Year: "year";
};
type ListPlansIntervalRemoveItemEnum2 = OpenEnum<typeof ListPlansIntervalRemoveItemEnum2>;
declare const ListPlansIntervalRemoveItemEnum1: {
readonly OneOff: "one_off";
readonly Week: "week";
readonly Month: "month";
readonly Quarter: "quarter";
readonly SemiAnnual: "semi_annual";
readonly Year: "year";
};
type ListPlansIntervalRemoveItemEnum1 = OpenEnum<typeof ListPlansIntervalRemoveItemEnum1>;
/**
* Filter for matching plan items. All provided fields must match (AND).
*/
type ListPlansPlanItemFilter = {
/**
* Match items linked to this feature.
*/
featureId?: string | undefined;
/**
* Match items with this billing method (prepaid or usage_based).
*/
billingMethod?: ListPlansRemoveItemBillingMethod | undefined;
/**
* Match items with this interval. Accepts either a BillingInterval (price-side) or a ResetInterval (reset-side, includes day/hour/minute) so price-less items keyed by reset.interval can be disambiguated.
*/
interval?: ListPlansIntervalRemoveItemEnum1 | ListPlansIntervalRemoveItemEnum2 | undefined;
/**
* Match items with this interval_count. Disambiguates between items that share an interval but differ in count.
*/
intervalCount?: number | undefined;
};
/**
* Unit of time for the trial ('day', 'month', 'year').
*/
declare const ListPlansVariantDetailsDurationType: {
readonly Day: "day";
readonly Month: "month";
readonly Year: "year";
};
/**
* Unit of time for the trial ('day', 'month', 'year').
*/
type ListPlansVariantDetailsDurationType = OpenEnum<typeof ListPlansVariantDetailsDurationType>;
/**
* Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
*/
declare const ListPlansVariantDetailsOnEnd: {
readonly Bill: "bill";
readonly Revert: "revert";
};
/**
* Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
*/
type ListPlansVariantDetailsOnEnd = OpenEnum<typeof ListPlansVariantDetailsOnEnd>;
/**
* Free trial configuration for a plan.
*/
type ListPlansFreeTrialParams = {
/**
* Number of duration_type periods the trial lasts.
*/
durationLength: number;
/**
* Unit of time for the trial ('day', 'month', 'year').
*/
durationType: ListPlansVariantDetailsDurationType;
/**
* If true, payment method required to start trial. Customer is charged after trial ends.
*/
cardRequired: boolean;
/**
* Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
*/
onEnd?: ListPlansVariantDetailsOnEnd | undefined;
};
/**
* The time interval for the purchase limit window.
*/
declare const ListPlansVariantDetailsPurchaseLimitInterval: {
readonly Hour: "hour";
readonly Day: "day";
readonly Week: "week";
readonly Month: "month";
};
/**
* The time interval for the purchase limit window.
*/
type ListPlansVariantDetailsPurchaseLimitInterval = OpenEnum<typeof ListPlansVariantDetailsPurchaseLimitInterval>;
/**
* Optional rate limit to cap how often auto top-ups occur.
*/
type ListPlansVariantDetailsPurchaseLimit = {
/**
* The time interval for the purchase limit window.
*/
interval: ListPlansVariantDetailsPurchaseLimitInterval;
/**
* Number of intervals in the purchase limit window.
*/
intervalCount: number;
/**
* Maximum number of auto top-ups allowed within the interval.
*/
limit: number;
};
type ListPlansVariantDetailsAutoTopup = {
/**
* The ID of the feature (credit balance) to auto top-up.
*/
featureId: string;
/**
* Whether auto top-up is enabled.
*/
enabled: boolean;
/**
* When the balance drops below this threshold, an auto top-up will be purchased.
*/
threshold: number;
/**
* Amount of credits to add per auto top-up.
*/
quantity: number;
/**
* Optional rate limit to cap how often auto top-ups occur.
*/
purchaseLimit?: ListPlansVariantDetailsPurchaseLimit | undefined;
/**
* When true, auto top-up creates a send_invoice invoice instead of auto-charging.
*/
invoiceMode?: boolean | undefined;
};
/**
* How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
*/
declare const ListPlansVariantDetailsLimitType: {
readonly Absolute: "absolute";
readonly UsagePercentage: "usage_percentage";
};
/**
* How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
*/
type ListPlansVariantDetailsLimitType = OpenEnum<typeof ListPlansVariantDetailsLimitType>;
type ListPlansVariantDetailsSpendLimit = {
/**
* Optional feature ID this spend limit applies to.
*/
featureId?: string | undefined;
/**
* Whether the overage spend limit is enabled.
*/
enabled: boolean;
/**
* How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
*/
limitType?: ListPlansVariantDetailsLimitType | undefined;
/**
* Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
*/
overageLimit?: number | undefined;
/**
* When true, overage for this feature is not posted to Stripe. Usage tracking and balance resets still behave normally.
*/
skipOverageBilling?: boolean | undefined;
};
/**
* Interval for the cap, aligned to the customer's billing cycle.
*/
declare const ListPlansVariantDetailsUsageLimitInterval: {
readonly Day: "day";
readonly Week: "week";
readonly Month: "month";
readonly Year: "year";
};
/**
* Interval for the cap, aligned to the customer's billing cycle.
*/
type ListPlansVariantDetailsUsageLimitInterval = OpenEnum<typeof ListPlansVariantDetailsUsageLimitInterval>;
/**
* When set, only usage from events whose properties match counts toward this cap. Omit to count all usage of the feature.
*/
type ListPlansVariantDetailsFilter = {
properties: {
[k: string]: any;
};
};
type ListPlansVariantDetailsUsageLimit = {
/**
* The feature this usage limit applies to.
*/
featureId: string;
/**
* Whether this usage limit is enabled.
*/
enabled: boolean;
/**
* Maximum units allowed per interval.
*/
limit: number;
/**
* Interval for the cap, aligned to the customer's billing cycle.
*/
interval: ListPlansVariantDetailsUsageLimitInterval;
/**
* When set, only usage from events whose properties match counts toward this cap. Omit to count all usage of the feature.
*/
filter?: ListPlansVariantDetailsFilter | undefined;
};
/**
* Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
*/
declare const ListPlansVariantDetailsThresholdType: {
readonly Usage: "usage";
readonly UsagePercentage: "usage_percentage";
readonly Remaining: "remaining";
readonly RemainingPercentage: "remaining_percentage";
};
/**
* Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
*/
type ListPlansVariantDetailsThresholdType = OpenEnum<typeof ListPlansVariantDetailsThresholdType>;
type ListPlansVariantDetailsUsageAlert = {
/**
* The feature ID this alert applies to.
*/
featureId?: string | undefined;
/**
* Whether this usage alert is enabled.
*/
enabled: boolean;
/**
* The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100).
*/
threshold: number;
/**
* Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
*/
thresholdType: ListPlansVariantDetailsThresholdType;
/**
* Optional user-defined label to distinguish multiple alerts on the same feature.
*/
name?: string | undefined;
};
type ListPlansVariantDetailsOverageAllowed = {
/**
* The feature ID this overage allowed control applies to.
*/
featureId: string;
/**
* Whether overage is allowed for this feature.
*/
enabled: boolean;
};
/**
* Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
*/
type ListPlansVariantDetailsBillingControls = {
/**
* List of auto top-up configurations per feature.
*/
autoTopups?: Array<ListPlansVariantDetailsAutoTopup> | undefined;
/**
* List of overage spend limits per feature (caps overage spend).
*/
spendLimits?: Array<ListPlansVariantDetailsSpendLimit> | undefined;
/**
* List of hard usage caps per feature (max units per interval).
*/
usageLimits?: Array<ListPlansVariantDetailsUsageLimit> | undefined;
/**
* List of usage alert configurations per feature.
*/
usageAlerts?: Array<ListPlansVariantDetailsUsageAlert> | undefined;
/**
* List of overage allowed controls per feature. When enabled, usage can exceed balance.
*/
overageAllowed?: Array<ListPlansVariantDetailsOverageAllowed> | undefined;
};
/**
* The customization that transforms the base plan into this variant.
*/
type ListPlansCustomize = {
/**
* Override the base price of the plan. Pass null to remove the base price.
*/
price?: ListPlansBasePrice | null | undefined;
/**
* Items to add to the plan.
*/
addItems?: Array<ListPlansPlanItem> | undefined;
/**
* Filters selecting items to remove from the plan.
*/
removeItems?: Array<ListPlansPlanItemFilter> | undefined;
/**
* Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.
*/
freeTrial?: ListPlansFreeTrialParams | null | undefined;
/**
* Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
*/
billingControls?: ListPlansVariantDetailsBillingControls | undefined;
};
/**
* Details about how this variant relates to its latest base plan.
*/
type ListPlansVariantDetails = {
/**
* The ID of the base plan this variant was derived from.
*/
basePlanId: string;
/**
* The customization that transforms the base plan into this variant.
*/
customize?: ListPlansCustomize | undefined;
};
/**
* Miscellaneous plan-level configuration flags.
*/
type ListPlansConfig = {
/**
* If true, entitlements attached to this plan will still reset on schedule even when the customer's product is in a past_due state.
*/
ignorePastDue: boolean;
};
/**
* The time interval for the purchase limit window.
*/
declare const ListPlansPurchaseLimitInterval: {
readonly Hour: "hour";
readonly Day: "day";
readonly Week: "week";
readonly Month: "month";
};
/**
* The time interval for the purchase limit window.
*/
type ListPlansPurchaseLimitInterval = OpenEnum<typeof ListPlansPurchaseLimitInterval>;
/**
* Optional rate limit to cap how often auto top-ups occur.
*/
type ListPlansPurchaseLimit = {
/**
* The time interval for the purchase limit window.
*/
interval: ListPlansPurchaseLimitInterval;
/**
* Number of intervals in the purchase limit window.
*/
intervalCount: number;
/**
* Maximum number of auto top-ups allowed within the interval.
*/
limit: number;
};
type ListPlansAutoTopup = {
/**
* The ID of the feature (credit balance) to auto top-up.
*/
featureId: string;
/**
* Whether auto top-up is enabled.
*/
enabled: boolean;
/**
* When the balance drops below this threshold, an auto top-up will be purchased.
*/
threshold: number;
/**
* Amount of credits to add per auto top-up.
*/
quantity: number;
/**
* Optional rate limit to cap how often auto top-ups occur.
*/
purchaseLimit?: ListPlansPurchaseLimit | undefined;
/**
* When true, auto top-up creates a send_invoice invoice instead of auto-charging.
*/
invoiceMode?: boolean | undefined;
};
/**
* How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
*/
declare const ListPlansLimitType: {
readonly Absolute: "absolute";
readonly UsagePercentage: "usage_percentage";
};
/**
* How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
*/
type ListPlansLimitType = OpenEnum<typeof ListPlansLimitType>;
type ListPlansSpendLimit = {
/**
* Optional feature ID this spend limit applies to.
*/
featureId?: string | undefined;
/**
* Whether the overage spend limit is enabled.
*/
enabled: boolean;
/**
* How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
*/
limitType?: ListPlansLimitType | undefined;
/**
* Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
*/
overageLimit?: number | undefined;
/**
* When true, overage for this feature is not posted to Stripe. Usage tracking and balance resets still behave normally.
*/
skipOverageBilling?: boolean | undefined;
};
/**
* Interval for the cap, aligned to the customer's billing cycle.
*/
declare const ListPlansUsageLimitInterval: {
readonly Day: "day";
readonly Week: "week";
readonly Month: "month";
readonly Year: "year";
};
/**
* Interval for the cap, aligned to the customer's billing cycle.
*/
type ListPlansUsageLimitInterval = OpenEnum<typeof ListPlansUsageLimitInterval>;
/**
* When set, only usage from events whose properties match counts toward this cap. Omit to count all usage of the feature.
*/
type ListPlansFilter = {
properties: {
[k: string]: any;
};
};
type ListPlansUsageLimit = {
/**
* The feature this usage limit applies to.
*/
featureId: string;
/**
* Whether this usage limit is enabled.
*/
enabled: boolean;
/**
* Maximum units allowed per interval.
*/
limit: number;
/**
* Interval for the cap, aligned to the customer's billing cycle.
*/
interval: ListPlansUsageLimitInterval;
/**
* When set, only usage from events whose properties match counts toward this cap. Omit to count all usage of the feature.
*/
filter?: ListPlansFilter | undefined;
};
/**
* Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
*/
declare const ListPlansThresholdType: {
readonly Usage: "usage";
readonly UsagePercentage: "usage_percentage";
readonly Remaining: "remaining";
readonly RemainingPercentage: "remaining_percentage";
};
/**
* Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
*/
type ListPlansThresholdType = OpenEnum<typeof ListPlansThresholdType>;
type ListPlansUsageAlert = {
/**
* The feature ID this alert applies to.
*/
featureId?: string | undefined;
/**
* Whether this usage alert is enabled.
*/
enabled: boolean;
/**
* The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100).
*/
threshold: number;
/**
* Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
*/
thresholdType: ListPlansThresholdType;
/**
* Optional user-defined label to distinguish multiple alerts on the same feature.
*/
name?: string | undefined;
};
type ListPlansOverageAllowed = {
/**
* The feature ID this overage allowed control applies to.
*/
featureId: string;
/**
* Whether overage is allowed for this feature.
*/
enabled: boolean;
};
/**
* Plan-level billing controls used as customer defaults.
*/
type ListPlansBillingControls = {
/**
* List of auto top-up configurations per feature.
*/
autoTopups?: Array<ListPlansAutoTopup> | undefined;
/**
* List of overage spend limits per feature (caps overage spend).
*/
spendLimits?: Array<ListPlansSpendLimit> | undefined;
/**
* List of hard usage caps per feature (max units per interval).
*/
usageLimits?: Array<ListPlansUsageLimit> | undefined;
/**
* List of usage alert configurations per feature.
*/
usageAlerts?: Array<ListPlansUsageAlert> | undefined;
/**
* List of overage allowed controls per feature. When enabled, usage can exceed balance.
*/
overageAllowed?: Array<ListPlansOverageAllowed> | undefined;
};
/**
* The customer's current status with this plan. 'active' if attached, 'scheduled' if pending activation.
*/
declare const ListPlansStatus: {
readonly Active: "active";
readonly Scheduled: "scheduled";
};
/**
* The customer's current status with this plan. 'active' if attached, 'scheduled' if pending activation.
*/
type ListPlansStatus = OpenEnum<typeof ListPlansStatus>;
/**
* The action that would occur if this plan were attached to the customer.
*/
declare const ListPlansAttachAction: {
readonly Activate: "activate";
readonly Upgrade: "upgrade";
readonly Downgrade: "downgrade";
readonly None: "none";
readonly Purchase: "purchase";
};
/**
* The action that would occur if this plan were attached to the customer.
*/
type ListPlansAttachAction = OpenEnum<typeof ListPlansAttachAction>;
type ListPlansCustomerEligibility = {
/**
* Whether the trial on this plan is available to this customer. For example, if the customer used the trial in the past, this will be false.
*/
trialAvailable?: boolean | undefined;
/**
* The customer's current status with this plan. 'active' if attached, 'scheduled' if pending activation.
*/
status?: ListPlansStatus | undefined;
/**
* Whether the customer's active instance of this plan is set to cancel.
*/
canceling?: boolean | undefined;
/**
* Whether the customer is currently on a free trial of this plan.
*/
trialing?: boolean | undefined;
/**
* The action that would occur if this plan were attached to the customer.
*/
attachAction: ListPlansAttachAction;
};
/**
* A plan defines a set of features, pricing, and entitlements that can be attached to customers.
*/
type ListPlansList = {
/**
* Unique identifier for the plan.
*/
id: string;
/**
* Display name of the plan.
*/
name: string;
/**
* Optional description of the plan.
*/
description: string | null;
/**
* Group identifier for organizing related plans. Plans in the same group are mutually exclusive.
*/
group: string | null;
/**
* Version number of the plan. Incremented when plan configuration changes.
*/
version: number;
/**
* Whether this is an add-on plan that can be attached alongside a main plan.
*/
addOn: boolean;
/**
* If true, this plan is automatically attached when a customer is created. Used for free plans.
*/
autoEnable: boolean;
/**
* Base recurring price for the plan. Null for free plans or usage-only plans.
*/
price: ListPlansPrice | null;
/**
* Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.
*/
items: Array<ListPlansItem>;
/**
* Free trial configuration. If set, new customers can try this plan before being charged.
*/
freeTrial?: ListPlansFreeTrial | undefined;
/**
* Unix timestamp (ms) when the plan was created.
*/
createdAt: number;
/**
* Environment this plan belongs to ('sandbox' or 'live').
*/
env: ListPlansEnv;
/**
* Whether the plan is archived. Archived plans cannot be attached to new customers.
*/
archived: boolean;
/**
* Deprecated. Use variant_details.base_plan_id instead. If this is a variant, the ID of the base plan it was created from.
*/
baseVariantId: string | null;
/**
* Details about how this variant relates to its latest base plan.
*/
variantDetails?: ListPlansVariantDetails | undefined;
/**
* Miscellaneous plan-level configuration flags.
*/
config: ListPlansConfig;
/**
* Plan-level billing controls used as customer defaults.
*/
billingControls?: ListPlansBillingControls | undefined;
/**
* Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
*/
metadata: {
[k: string]: any;
};
customerEligibility?: ListPlansCustomerEligibility | undefined;
};
/**
* OK
*/
type ListPlansResponse = {
list: Array<ListPlansList>;
};
export type { ListPlansResponse as L, ListPlansList as a };