export interface Plan { /** * Unique ID for this plan. English alphanumeric characters with no special characters except underscore. If the client does not define an ID, Rapyd generates a string starting with **plan_**. */ id: `plan_${string}`; /** * Determines which quantity is used to calculate the pricing. One of the following: * - **max** - The maximum reported usage within the billing cycle. * - **sum** - The sum of all usage during a billing cycle. This is the default. * - **last_during_period** - The last usage reported within the billing cycle. * - **last_ever** - The last usage ever reported, if the latest billing cycles contain no usage at all. * * Required when `usage_type` is **metered**. * * Relevant when `billing_scheme` is set to **per_unit**. */ aggregate_usage: 'max' | 'sum' | 'last_during_period' | 'last_ever'; /** * The amount to charge, in units of the currency defined in `currency`. Decimal, including the correct number of decimal places for the currency exponent, as defined in ISO 2417:2015. If the amount is a whole number, use an integer and not a decimal. * * For a free service, use 0. Must be null when `tiers` is set. * * Relevant when `billing_scheme` is set to **per_unit**. */ amount: number; /** * Describes how to compute the price. One of the following: * - **per_unit** - The amount specified in `amount` is charged for each unit. Also set these related fields: `amount`, `transform_usage`, `usage_type`, `aggregate_usage`. * This is the default. * * - **tiered** - The unit pricing is computed using a tiering strategy as defined with the `tiers` and `tiers_mode` fields. */ billing_scheme: 'per_unit' | 'tiered'; /** * Time the 'plan' object was created, in [*Unix time*](ref:glossary). Response only. */ created_at: number; /** * Three-letter ISO 4217 code for the currency used in fields that represent monetary amounts. Uppercase. */ currency: string; /** * Specifies the units used in defining the billing cycle. One of the following: * - **day** * - **week** * - **month** * - **year** * * Maximum interval is 1 year. */ interval: 'day' | 'week' | 'month' | 'year'; /** * Number of time intervals in the billing cycle. Integer. See `interval`. */ interval_count: number; /** * A JSON object defined by the client. */ metadata: object; /** * Brief description of the plan. */ nickname: string; /** * The ID of the product that this plan is for, and fields describing this product in the plan. * * For more information, see [Product Object](ref:product-object). */ product: string | object; /** * Defines a tiered pricing structure. Each tier object represents a pricing tier, and contains the following fields: * - `amount` - The price for each item in this tier. Decimal number. * - `up_to` - The upper volume limit for this tier. Valid values: **inf** (infinite) or an integer. * - `flat_amount` - Additional price for the entire tier. Default is 0. * * Relevant when `billing_scheme` is set to **tiered**. For more information, see [Pricing Plans](ref:pricing-plans). */ tiers: ({ amount: unknown; up_to: unknown; flat_amount: unknown; })[]; /** * Determines the mode for calculating the total tiered charge. One of the following values: * - **graduated** - The total cost at each price tier is calculated separately, then all tier charges are added together. * - **volume** - The total cost is calculated as the number of items times the applicable tier price. * * Relevant when `billing_scheme` is set to **tiered**. For more information, see [Pricing Plans](ref:pricing-plans). */ tiers_mode: 'graduated' | 'volume'; /** * Defines the transformation that is applied to the reported usage before the billed price is computed. The transformation divides the quantity by the divisor specified in `divide_by`, then rounds up or down according to the setting in `round`. Relevant when `billing_scheme` is set to **per_unit**. * * Contains the following fields: * - `divide_by` - Indicates the divisor in the transformation calculation. Integer. Default is 1. * - `round` - Indicates whether the reported number of units should be rounded **up** or **down** to the next whole quantity specified in `divide_by`. String. Default is **up**. * * For more information, see ***Transformation Pricing*** in [Pricing Plans](ref:pricing-plans). * * Relevant when `billing_scheme` is set to **per_unit**. */ transform_usage: { divide_by: unknown; round: unknown; }; /** * Specifies the number of days before charges begin to accrue. Use this parameter to define a free trial period for a service. */ trial_period_days: number; /** * Determines whether the customer is billed when the service is not actually used. Relevant when `billing_scheme` is set to **per_unit**. One of the following: * - **metered** - The customer is billed only for actual usage. You must also set `aggregate_usage`. * - **licensed** - The customer is billed even if the service is not used. This is the default. * * For more information, see ***Transformation Pricing*** in [Pricing Plans](ref:pricing-plans). */ usage_type: 'metered' | 'licensed'; } //# sourceMappingURL=Plan.d.ts.map