diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ad4acf8c..b5441c01 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.37.0" + ".": "4.38.0" } diff --git a/.stats.yml b/.stats.yml index 6a74fe0f..7d050298 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0f43f737c6520ed2a2407628511350362959997f89a868c50aa38d47d5791171.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-14d1c1e4560c65c7c62f23343268ece4476ae079cd01ba2e6b924efde5f97c3e.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 22e57a1c..068ec2c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 4.38.0 (2024-11-26) + +Full Changelog: [v4.37.0...v4.38.0](https://github.com/orbcorp/orb-node/compare/v4.37.0...v4.38.0) + +### Features + +* **api:** api update ([#405](https://github.com/orbcorp/orb-node/issues/405)) ([c1e35f2](https://github.com/orbcorp/orb-node/commit/c1e35f2e8b6263b2848a1ee9d579bef845a339f1)) + + +### Chores + +* **internal:** codegen related update ([#402](https://github.com/orbcorp/orb-node/issues/402)) ([87f4432](https://github.com/orbcorp/orb-node/commit/87f44324bcbc57e283da122a6f188db6e3f42f35)) +* **internal:** codegen related update ([#404](https://github.com/orbcorp/orb-node/issues/404)) ([e16b1f7](https://github.com/orbcorp/orb-node/commit/e16b1f7bc414b78db676d9bc5cc70767ac1c6797)) + ## 4.37.0 (2024-11-25) Full Changelog: [v4.36.0...v4.37.0](https://github.com/orbcorp/orb-node/compare/v4.36.0...v4.37.0) diff --git a/package.json b/package.json index f1d2f869..51750d3d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orb-billing", - "version": "4.37.0", + "version": "4.38.0", "description": "The official TypeScript library for the Orb API", "author": "Orb ", "types": "dist/index.d.ts", diff --git a/scripts/build b/scripts/build index 19d2b38d..1ada5a8a 100755 --- a/scripts/build +++ b/scripts/build @@ -32,7 +32,7 @@ npm exec tsc-multi # copy over handwritten .js/.mjs/.d.ts files cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto -# we need to add exports = module.exports = Orb TypeScript to index.js; +# we need to add exports = module.exports = Orb to index.js; # No way to get that from index.ts because it would cause compile errors # when building .mjs node scripts/utils/fix-index-exports.cjs diff --git a/src/resources/plans/plans.ts b/src/resources/plans/plans.ts index d56650a3..934d9c4a 100644 --- a/src/resources/plans/plans.ts +++ b/src/resources/plans/plans.ts @@ -83,6 +83,18 @@ export class PlansPage extends Page {} export interface Plan { id: string; + /** + * Adjustments for this plan. If the plan has phases, this includes adjustments + * across all phases of the plan. + */ + adjustments: Array< + | Plan.AmountDiscountAdjustment + | Plan.PercentageDiscountAdjustment + | Plan.UsageDiscountAdjustment + | Plan.MinimumAdjustment + | Plan.MaximumAdjustment + >; + base_plan: Plan.BasePlan | null; /** @@ -167,6 +179,176 @@ export interface Plan { } export namespace Plan { + export interface AmountDiscountAdjustment { + id: string; + + adjustment_type: 'amount_discount'; + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + amount_discount: string; + + /** + * The price IDs that this adjustment applies to. + */ + applies_to_price_ids: Array; + + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + + /** + * The reason for the adjustment. + */ + reason: string | null; + } + + export interface PercentageDiscountAdjustment { + id: string; + + adjustment_type: 'percentage_discount'; + + /** + * The price IDs that this adjustment applies to. + */ + applies_to_price_ids: Array; + + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The percentage (as a value between 0 and 1) by which to discount the price + * intervals this adjustment applies to in a given billing period. + */ + percentage_discount: number; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + + /** + * The reason for the adjustment. + */ + reason: string | null; + } + + export interface UsageDiscountAdjustment { + id: string; + + adjustment_type: 'usage_discount'; + + /** + * The price IDs that this adjustment applies to. + */ + applies_to_price_ids: Array; + + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + + /** + * The reason for the adjustment. + */ + reason: string | null; + + /** + * The number of usage units by which to discount the price this adjustment applies + * to in a given billing period. + */ + usage_discount: number; + } + + export interface MinimumAdjustment { + id: string; + + adjustment_type: 'minimum'; + + /** + * The price IDs that this adjustment applies to. + */ + applies_to_price_ids: Array; + + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The item ID that revenue from this minimum will be attributed to. + */ + item_id: string; + + /** + * The minimum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + minimum_amount: string; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + + /** + * The reason for the adjustment. + */ + reason: string | null; + } + + export interface MaximumAdjustment { + id: string; + + adjustment_type: 'maximum'; + + /** + * The price IDs that this adjustment applies to. + */ + applies_to_price_ids: Array; + + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + maximum_amount: string; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + + /** + * The reason for the adjustment. + */ + reason: string | null; + } + export interface BasePlan { id: string | null; diff --git a/src/resources/subscriptions.ts b/src/resources/subscriptions.ts index 4978ecb5..d67e342a 100644 --- a/src/resources/subscriptions.ts +++ b/src/resources/subscriptions.ts @@ -1249,6 +1249,8 @@ export namespace Subscription { export namespace AdjustmentInterval { export interface AmountDiscountAdjustment { + id: string; + adjustment_type: 'amount_discount'; /** @@ -1262,6 +1264,17 @@ export namespace Subscription { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -1269,6 +1282,8 @@ export namespace Subscription { } export interface PercentageDiscountAdjustment { + id: string; + adjustment_type: 'percentage_discount'; /** @@ -1276,12 +1291,23 @@ export namespace Subscription { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The percentage (as a value between 0 and 1) by which to discount the price * intervals this adjustment applies to in a given billing period. */ percentage_discount: number; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -1289,6 +1315,8 @@ export namespace Subscription { } export interface UsageDiscountAdjustment { + id: string; + adjustment_type: 'usage_discount'; /** @@ -1296,6 +1324,17 @@ export namespace Subscription { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -1309,6 +1348,8 @@ export namespace Subscription { } export interface MinimumAdjustment { + id: string; + adjustment_type: 'minimum'; /** @@ -1316,6 +1357,12 @@ export namespace Subscription { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The item ID that revenue from this minimum will be attributed to. */ @@ -1327,6 +1374,11 @@ export namespace Subscription { */ minimum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -1334,6 +1386,8 @@ export namespace Subscription { } export interface MaximumAdjustment { + id: string; + adjustment_type: 'maximum'; /** @@ -1341,12 +1395,23 @@ export namespace Subscription { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The maximum amount to charge in a given billing period for the prices this * adjustment applies to. */ maximum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -2092,6 +2157,8 @@ export namespace SubscriptionCreateResponse { export namespace AdjustmentInterval { export interface AmountDiscountAdjustment { + id: string; + adjustment_type: 'amount_discount'; /** @@ -2105,6 +2172,17 @@ export namespace SubscriptionCreateResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -2112,6 +2190,8 @@ export namespace SubscriptionCreateResponse { } export interface PercentageDiscountAdjustment { + id: string; + adjustment_type: 'percentage_discount'; /** @@ -2119,12 +2199,23 @@ export namespace SubscriptionCreateResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The percentage (as a value between 0 and 1) by which to discount the price * intervals this adjustment applies to in a given billing period. */ percentage_discount: number; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -2132,6 +2223,8 @@ export namespace SubscriptionCreateResponse { } export interface UsageDiscountAdjustment { + id: string; + adjustment_type: 'usage_discount'; /** @@ -2139,6 +2232,17 @@ export namespace SubscriptionCreateResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -2152,6 +2256,8 @@ export namespace SubscriptionCreateResponse { } export interface MinimumAdjustment { + id: string; + adjustment_type: 'minimum'; /** @@ -2159,6 +2265,12 @@ export namespace SubscriptionCreateResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The item ID that revenue from this minimum will be attributed to. */ @@ -2170,6 +2282,11 @@ export namespace SubscriptionCreateResponse { */ minimum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -2177,6 +2294,8 @@ export namespace SubscriptionCreateResponse { } export interface MaximumAdjustment { + id: string; + adjustment_type: 'maximum'; /** @@ -2184,12 +2303,23 @@ export namespace SubscriptionCreateResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The maximum amount to charge in a given billing period for the prices this * adjustment applies to. */ maximum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -2853,6 +2983,8 @@ export namespace SubscriptionCancelResponse { export namespace AdjustmentInterval { export interface AmountDiscountAdjustment { + id: string; + adjustment_type: 'amount_discount'; /** @@ -2866,6 +2998,17 @@ export namespace SubscriptionCancelResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -2873,6 +3016,8 @@ export namespace SubscriptionCancelResponse { } export interface PercentageDiscountAdjustment { + id: string; + adjustment_type: 'percentage_discount'; /** @@ -2880,12 +3025,23 @@ export namespace SubscriptionCancelResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The percentage (as a value between 0 and 1) by which to discount the price * intervals this adjustment applies to in a given billing period. */ percentage_discount: number; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -2893,6 +3049,8 @@ export namespace SubscriptionCancelResponse { } export interface UsageDiscountAdjustment { + id: string; + adjustment_type: 'usage_discount'; /** @@ -2900,6 +3058,17 @@ export namespace SubscriptionCancelResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -2913,6 +3082,8 @@ export namespace SubscriptionCancelResponse { } export interface MinimumAdjustment { + id: string; + adjustment_type: 'minimum'; /** @@ -2920,6 +3091,12 @@ export namespace SubscriptionCancelResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The item ID that revenue from this minimum will be attributed to. */ @@ -2931,6 +3108,11 @@ export namespace SubscriptionCancelResponse { */ minimum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -2938,6 +3120,8 @@ export namespace SubscriptionCancelResponse { } export interface MaximumAdjustment { + id: string; + adjustment_type: 'maximum'; /** @@ -2945,12 +3129,23 @@ export namespace SubscriptionCancelResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The maximum amount to charge in a given billing period for the prices this * adjustment applies to. */ maximum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -3917,6 +4112,8 @@ export namespace SubscriptionPriceIntervalsResponse { export namespace AdjustmentInterval { export interface AmountDiscountAdjustment { + id: string; + adjustment_type: 'amount_discount'; /** @@ -3930,6 +4127,17 @@ export namespace SubscriptionPriceIntervalsResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -3937,6 +4145,8 @@ export namespace SubscriptionPriceIntervalsResponse { } export interface PercentageDiscountAdjustment { + id: string; + adjustment_type: 'percentage_discount'; /** @@ -3944,12 +4154,23 @@ export namespace SubscriptionPriceIntervalsResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The percentage (as a value between 0 and 1) by which to discount the price * intervals this adjustment applies to in a given billing period. */ percentage_discount: number; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -3957,6 +4178,8 @@ export namespace SubscriptionPriceIntervalsResponse { } export interface UsageDiscountAdjustment { + id: string; + adjustment_type: 'usage_discount'; /** @@ -3964,6 +4187,17 @@ export namespace SubscriptionPriceIntervalsResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -3977,6 +4211,8 @@ export namespace SubscriptionPriceIntervalsResponse { } export interface MinimumAdjustment { + id: string; + adjustment_type: 'minimum'; /** @@ -3984,6 +4220,12 @@ export namespace SubscriptionPriceIntervalsResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The item ID that revenue from this minimum will be attributed to. */ @@ -3995,6 +4237,11 @@ export namespace SubscriptionPriceIntervalsResponse { */ minimum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -4002,6 +4249,8 @@ export namespace SubscriptionPriceIntervalsResponse { } export interface MaximumAdjustment { + id: string; + adjustment_type: 'maximum'; /** @@ -4009,12 +4258,23 @@ export namespace SubscriptionPriceIntervalsResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The maximum amount to charge in a given billing period for the prices this * adjustment applies to. */ maximum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -4678,6 +4938,8 @@ export namespace SubscriptionSchedulePlanChangeResponse { export namespace AdjustmentInterval { export interface AmountDiscountAdjustment { + id: string; + adjustment_type: 'amount_discount'; /** @@ -4691,6 +4953,17 @@ export namespace SubscriptionSchedulePlanChangeResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -4698,6 +4971,8 @@ export namespace SubscriptionSchedulePlanChangeResponse { } export interface PercentageDiscountAdjustment { + id: string; + adjustment_type: 'percentage_discount'; /** @@ -4705,12 +4980,23 @@ export namespace SubscriptionSchedulePlanChangeResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The percentage (as a value between 0 and 1) by which to discount the price * intervals this adjustment applies to in a given billing period. */ percentage_discount: number; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -4718,6 +5004,8 @@ export namespace SubscriptionSchedulePlanChangeResponse { } export interface UsageDiscountAdjustment { + id: string; + adjustment_type: 'usage_discount'; /** @@ -4725,6 +5013,17 @@ export namespace SubscriptionSchedulePlanChangeResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -4738,6 +5037,8 @@ export namespace SubscriptionSchedulePlanChangeResponse { } export interface MinimumAdjustment { + id: string; + adjustment_type: 'minimum'; /** @@ -4745,6 +5046,12 @@ export namespace SubscriptionSchedulePlanChangeResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The item ID that revenue from this minimum will be attributed to. */ @@ -4756,6 +5063,11 @@ export namespace SubscriptionSchedulePlanChangeResponse { */ minimum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -4763,6 +5075,8 @@ export namespace SubscriptionSchedulePlanChangeResponse { } export interface MaximumAdjustment { + id: string; + adjustment_type: 'maximum'; /** @@ -4770,12 +5084,23 @@ export namespace SubscriptionSchedulePlanChangeResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The maximum amount to charge in a given billing period for the prices this * adjustment applies to. */ maximum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -5439,6 +5764,8 @@ export namespace SubscriptionTriggerPhaseResponse { export namespace AdjustmentInterval { export interface AmountDiscountAdjustment { + id: string; + adjustment_type: 'amount_discount'; /** @@ -5452,6 +5779,17 @@ export namespace SubscriptionTriggerPhaseResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -5459,6 +5797,8 @@ export namespace SubscriptionTriggerPhaseResponse { } export interface PercentageDiscountAdjustment { + id: string; + adjustment_type: 'percentage_discount'; /** @@ -5466,12 +5806,23 @@ export namespace SubscriptionTriggerPhaseResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The percentage (as a value between 0 and 1) by which to discount the price * intervals this adjustment applies to in a given billing period. */ percentage_discount: number; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -5479,6 +5830,8 @@ export namespace SubscriptionTriggerPhaseResponse { } export interface UsageDiscountAdjustment { + id: string; + adjustment_type: 'usage_discount'; /** @@ -5486,6 +5839,17 @@ export namespace SubscriptionTriggerPhaseResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -5499,6 +5863,8 @@ export namespace SubscriptionTriggerPhaseResponse { } export interface MinimumAdjustment { + id: string; + adjustment_type: 'minimum'; /** @@ -5506,6 +5872,12 @@ export namespace SubscriptionTriggerPhaseResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The item ID that revenue from this minimum will be attributed to. */ @@ -5517,6 +5889,11 @@ export namespace SubscriptionTriggerPhaseResponse { */ minimum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -5524,6 +5901,8 @@ export namespace SubscriptionTriggerPhaseResponse { } export interface MaximumAdjustment { + id: string; + adjustment_type: 'maximum'; /** @@ -5531,12 +5910,23 @@ export namespace SubscriptionTriggerPhaseResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The maximum amount to charge in a given billing period for the prices this * adjustment applies to. */ maximum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -6200,6 +6590,8 @@ export namespace SubscriptionUnscheduleCancellationResponse { export namespace AdjustmentInterval { export interface AmountDiscountAdjustment { + id: string; + adjustment_type: 'amount_discount'; /** @@ -6213,6 +6605,17 @@ export namespace SubscriptionUnscheduleCancellationResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -6220,6 +6623,8 @@ export namespace SubscriptionUnscheduleCancellationResponse { } export interface PercentageDiscountAdjustment { + id: string; + adjustment_type: 'percentage_discount'; /** @@ -6227,12 +6632,23 @@ export namespace SubscriptionUnscheduleCancellationResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The percentage (as a value between 0 and 1) by which to discount the price * intervals this adjustment applies to in a given billing period. */ percentage_discount: number; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -6240,6 +6656,8 @@ export namespace SubscriptionUnscheduleCancellationResponse { } export interface UsageDiscountAdjustment { + id: string; + adjustment_type: 'usage_discount'; /** @@ -6247,6 +6665,17 @@ export namespace SubscriptionUnscheduleCancellationResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -6260,6 +6689,8 @@ export namespace SubscriptionUnscheduleCancellationResponse { } export interface MinimumAdjustment { + id: string; + adjustment_type: 'minimum'; /** @@ -6267,6 +6698,12 @@ export namespace SubscriptionUnscheduleCancellationResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The item ID that revenue from this minimum will be attributed to. */ @@ -6278,6 +6715,11 @@ export namespace SubscriptionUnscheduleCancellationResponse { */ minimum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -6285,6 +6727,8 @@ export namespace SubscriptionUnscheduleCancellationResponse { } export interface MaximumAdjustment { + id: string; + adjustment_type: 'maximum'; /** @@ -6292,12 +6736,23 @@ export namespace SubscriptionUnscheduleCancellationResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The maximum amount to charge in a given billing period for the prices this * adjustment applies to. */ maximum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -6961,6 +7416,8 @@ export namespace SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse { export namespace AdjustmentInterval { export interface AmountDiscountAdjustment { + id: string; + adjustment_type: 'amount_discount'; /** @@ -6974,6 +7431,17 @@ export namespace SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -6981,6 +7449,8 @@ export namespace SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse { } export interface PercentageDiscountAdjustment { + id: string; + adjustment_type: 'percentage_discount'; /** @@ -6988,12 +7458,23 @@ export namespace SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The percentage (as a value between 0 and 1) by which to discount the price * intervals this adjustment applies to in a given billing period. */ percentage_discount: number; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -7001,6 +7482,8 @@ export namespace SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse { } export interface UsageDiscountAdjustment { + id: string; + adjustment_type: 'usage_discount'; /** @@ -7008,6 +7491,17 @@ export namespace SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -7021,6 +7515,8 @@ export namespace SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse { } export interface MinimumAdjustment { + id: string; + adjustment_type: 'minimum'; /** @@ -7028,6 +7524,12 @@ export namespace SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The item ID that revenue from this minimum will be attributed to. */ @@ -7039,6 +7541,11 @@ export namespace SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse { */ minimum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -7046,6 +7553,8 @@ export namespace SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse { } export interface MaximumAdjustment { + id: string; + adjustment_type: 'maximum'; /** @@ -7053,12 +7562,23 @@ export namespace SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The maximum amount to charge in a given billing period for the prices this * adjustment applies to. */ maximum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -7722,6 +8242,8 @@ export namespace SubscriptionUnschedulePendingPlanChangesResponse { export namespace AdjustmentInterval { export interface AmountDiscountAdjustment { + id: string; + adjustment_type: 'amount_discount'; /** @@ -7735,6 +8257,17 @@ export namespace SubscriptionUnschedulePendingPlanChangesResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -7742,6 +8275,8 @@ export namespace SubscriptionUnschedulePendingPlanChangesResponse { } export interface PercentageDiscountAdjustment { + id: string; + adjustment_type: 'percentage_discount'; /** @@ -7749,12 +8284,23 @@ export namespace SubscriptionUnschedulePendingPlanChangesResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The percentage (as a value between 0 and 1) by which to discount the price * intervals this adjustment applies to in a given billing period. */ percentage_discount: number; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -7762,6 +8308,8 @@ export namespace SubscriptionUnschedulePendingPlanChangesResponse { } export interface UsageDiscountAdjustment { + id: string; + adjustment_type: 'usage_discount'; /** @@ -7769,6 +8317,17 @@ export namespace SubscriptionUnschedulePendingPlanChangesResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -7782,6 +8341,8 @@ export namespace SubscriptionUnschedulePendingPlanChangesResponse { } export interface MinimumAdjustment { + id: string; + adjustment_type: 'minimum'; /** @@ -7789,6 +8350,12 @@ export namespace SubscriptionUnschedulePendingPlanChangesResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The item ID that revenue from this minimum will be attributed to. */ @@ -7800,6 +8367,11 @@ export namespace SubscriptionUnschedulePendingPlanChangesResponse { */ minimum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -7807,6 +8379,8 @@ export namespace SubscriptionUnschedulePendingPlanChangesResponse { } export interface MaximumAdjustment { + id: string; + adjustment_type: 'maximum'; /** @@ -7814,12 +8388,23 @@ export namespace SubscriptionUnschedulePendingPlanChangesResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The maximum amount to charge in a given billing period for the prices this * adjustment applies to. */ maximum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -8483,6 +9068,8 @@ export namespace SubscriptionUpdateFixedFeeQuantityResponse { export namespace AdjustmentInterval { export interface AmountDiscountAdjustment { + id: string; + adjustment_type: 'amount_discount'; /** @@ -8496,6 +9083,17 @@ export namespace SubscriptionUpdateFixedFeeQuantityResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -8503,6 +9101,8 @@ export namespace SubscriptionUpdateFixedFeeQuantityResponse { } export interface PercentageDiscountAdjustment { + id: string; + adjustment_type: 'percentage_discount'; /** @@ -8510,12 +9110,23 @@ export namespace SubscriptionUpdateFixedFeeQuantityResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The percentage (as a value between 0 and 1) by which to discount the price * intervals this adjustment applies to in a given billing period. */ percentage_discount: number; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -8523,6 +9134,8 @@ export namespace SubscriptionUpdateFixedFeeQuantityResponse { } export interface UsageDiscountAdjustment { + id: string; + adjustment_type: 'usage_discount'; /** @@ -8530,6 +9143,17 @@ export namespace SubscriptionUpdateFixedFeeQuantityResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -8543,6 +9167,8 @@ export namespace SubscriptionUpdateFixedFeeQuantityResponse { } export interface MinimumAdjustment { + id: string; + adjustment_type: 'minimum'; /** @@ -8550,6 +9176,12 @@ export namespace SubscriptionUpdateFixedFeeQuantityResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The item ID that revenue from this minimum will be attributed to. */ @@ -8561,6 +9193,11 @@ export namespace SubscriptionUpdateFixedFeeQuantityResponse { */ minimum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -8568,6 +9205,8 @@ export namespace SubscriptionUpdateFixedFeeQuantityResponse { } export interface MaximumAdjustment { + id: string; + adjustment_type: 'maximum'; /** @@ -8575,12 +9214,23 @@ export namespace SubscriptionUpdateFixedFeeQuantityResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The maximum amount to charge in a given billing period for the prices this * adjustment applies to. */ maximum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -9244,6 +9894,8 @@ export namespace SubscriptionUpdateTrialResponse { export namespace AdjustmentInterval { export interface AmountDiscountAdjustment { + id: string; + adjustment_type: 'amount_discount'; /** @@ -9257,6 +9909,17 @@ export namespace SubscriptionUpdateTrialResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -9264,6 +9927,8 @@ export namespace SubscriptionUpdateTrialResponse { } export interface PercentageDiscountAdjustment { + id: string; + adjustment_type: 'percentage_discount'; /** @@ -9271,12 +9936,23 @@ export namespace SubscriptionUpdateTrialResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The percentage (as a value between 0 and 1) by which to discount the price * intervals this adjustment applies to in a given billing period. */ percentage_discount: number; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -9284,6 +9960,8 @@ export namespace SubscriptionUpdateTrialResponse { } export interface UsageDiscountAdjustment { + id: string; + adjustment_type: 'usage_discount'; /** @@ -9291,6 +9969,17 @@ export namespace SubscriptionUpdateTrialResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -9304,6 +9993,8 @@ export namespace SubscriptionUpdateTrialResponse { } export interface MinimumAdjustment { + id: string; + adjustment_type: 'minimum'; /** @@ -9311,6 +10002,12 @@ export namespace SubscriptionUpdateTrialResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The item ID that revenue from this minimum will be attributed to. */ @@ -9322,6 +10019,11 @@ export namespace SubscriptionUpdateTrialResponse { */ minimum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -9329,6 +10031,8 @@ export namespace SubscriptionUpdateTrialResponse { } export interface MaximumAdjustment { + id: string; + adjustment_type: 'maximum'; /** @@ -9336,12 +10040,23 @@ export namespace SubscriptionUpdateTrialResponse { */ applies_to_price_ids: Array; + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + is_invoice_level: boolean; + /** * The maximum amount to charge in a given billing period for the prices this * adjustment applies to. */ maximum_amount: string; + /** + * The plan phase in which this adjustment is active. + */ + plan_phase_order: number | null; + /** * The reason for the adjustment. */ @@ -9888,6 +10603,14 @@ export interface SubscriptionCreateParams { */ external_plan_id?: string | null; + /** + * An additional filter to apply to usage queries. This filter must be expressed as + * a boolean + * [computed property](../guides/extensibility/advanced-metrics#computed-properties). + * If null, usage queries will not include any additional filter. + */ + filter?: string | null; + /** * The phase of the plan to start with */ @@ -9975,6 +10698,7 @@ export namespace SubscriptionCreateParams { */ adjustment: | AddAdjustment.NewPercentageDiscount + | AddAdjustment.NewUsageDiscount | AddAdjustment.NewAmountDiscount | AddAdjustment.NewMinimum | AddAdjustment.NewMaximum; @@ -10009,6 +10733,29 @@ export namespace SubscriptionCreateParams { applies_to_price_ids: Array; percentage_discount: number; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; + } + + export interface NewUsageDiscount { + adjustment_type: 'usage_discount'; + + /** + * The set of price IDs to which this adjustment applies. + */ + applies_to_price_ids: Array; + + usage_discount: number; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewAmountDiscount { @@ -10020,6 +10767,12 @@ export namespace SubscriptionCreateParams { * The set of price IDs to which this adjustment applies. */ applies_to_price_ids: Array; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewMinimum { @@ -10036,6 +10789,12 @@ export namespace SubscriptionCreateParams { item_id: string; minimum_amount: string; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewMaximum { @@ -10047,12 +10806,19 @@ export namespace SubscriptionCreateParams { applies_to_price_ids: Array; maximum_amount: string; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } } export interface AddPrice { /** - * The subscription's discounts for this price. + * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * discounts for this price. */ discounts?: Array | null; @@ -10069,12 +10835,14 @@ export namespace SubscriptionCreateParams { external_price_id?: string | null; /** - * The subscription's maximum amount for this price. + * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * maximum amount for this price. */ maximum_amount?: string | null; /** - * The subscription's minimum amount for this price. + * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * minimum amount for this price. */ minimum_amount?: string | null; @@ -12504,6 +13272,7 @@ export namespace SubscriptionCreateParams { */ adjustment: | ReplaceAdjustment.NewPercentageDiscount + | ReplaceAdjustment.NewUsageDiscount | ReplaceAdjustment.NewAmountDiscount | ReplaceAdjustment.NewMinimum | ReplaceAdjustment.NewMaximum; @@ -12524,6 +13293,29 @@ export namespace SubscriptionCreateParams { applies_to_price_ids: Array; percentage_discount: number; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; + } + + export interface NewUsageDiscount { + adjustment_type: 'usage_discount'; + + /** + * The set of price IDs to which this adjustment applies. + */ + applies_to_price_ids: Array; + + usage_discount: number; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewAmountDiscount { @@ -12535,6 +13327,12 @@ export namespace SubscriptionCreateParams { * The set of price IDs to which this adjustment applies. */ applies_to_price_ids: Array; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewMinimum { @@ -12551,6 +13349,12 @@ export namespace SubscriptionCreateParams { item_id: string; minimum_amount: string; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewMaximum { @@ -12562,6 +13366,12 @@ export namespace SubscriptionCreateParams { applies_to_price_ids: Array; maximum_amount: string; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } } @@ -12572,7 +13382,8 @@ export namespace SubscriptionCreateParams { replaces_price_id: string; /** - * The subscription's discounts for the replacement price. + * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * discounts for the replacement price. */ discounts?: Array | null; @@ -12587,12 +13398,14 @@ export namespace SubscriptionCreateParams { fixed_price_quantity?: number | null; /** - * The subscription's maximum amount for the replacement price. + * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * maximum amount for the replacement price. */ maximum_amount?: string | null; /** - * The subscription's minimum amount for the replacement price. + * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * minimum amount for the replacement price. */ minimum_amount?: string | null; @@ -18190,6 +19003,7 @@ export namespace SubscriptionPriceIntervalsParams { */ adjustment: | AddAdjustment.NewPercentageDiscount + | AddAdjustment.NewUsageDiscount | AddAdjustment.NewAmountDiscount | AddAdjustment.NewMinimum | AddAdjustment.NewMaximum; @@ -18217,6 +19031,29 @@ export namespace SubscriptionPriceIntervalsParams { applies_to_price_ids: Array; percentage_discount: number; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; + } + + export interface NewUsageDiscount { + adjustment_type: 'usage_discount'; + + /** + * The set of price IDs to which this adjustment applies. + */ + applies_to_price_ids: Array; + + usage_discount: number; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewAmountDiscount { @@ -18228,6 +19065,12 @@ export namespace SubscriptionPriceIntervalsParams { * The set of price IDs to which this adjustment applies. */ applies_to_price_ids: Array; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewMinimum { @@ -18244,6 +19087,12 @@ export namespace SubscriptionPriceIntervalsParams { item_id: string; minimum_amount: string; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewMaximum { @@ -18255,6 +19104,12 @@ export namespace SubscriptionPriceIntervalsParams { applies_to_price_ids: Array; maximum_amount: string; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } } @@ -18389,6 +19244,14 @@ export interface SubscriptionSchedulePlanChangeParams { */ external_plan_id?: string | null; + /** + * An additional filter to apply to usage queries. This filter must be expressed as + * a boolean + * [computed property](../guides/extensibility/advanced-metrics#computed-properties). + * If null, usage queries will not include any additional filter. + */ + filter?: string | null; + /** * The phase of the plan to start with */ @@ -18467,6 +19330,7 @@ export namespace SubscriptionSchedulePlanChangeParams { */ adjustment: | AddAdjustment.NewPercentageDiscount + | AddAdjustment.NewUsageDiscount | AddAdjustment.NewAmountDiscount | AddAdjustment.NewMinimum | AddAdjustment.NewMaximum; @@ -18501,6 +19365,29 @@ export namespace SubscriptionSchedulePlanChangeParams { applies_to_price_ids: Array; percentage_discount: number; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; + } + + export interface NewUsageDiscount { + adjustment_type: 'usage_discount'; + + /** + * The set of price IDs to which this adjustment applies. + */ + applies_to_price_ids: Array; + + usage_discount: number; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewAmountDiscount { @@ -18512,6 +19399,12 @@ export namespace SubscriptionSchedulePlanChangeParams { * The set of price IDs to which this adjustment applies. */ applies_to_price_ids: Array; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewMinimum { @@ -18528,6 +19421,12 @@ export namespace SubscriptionSchedulePlanChangeParams { item_id: string; minimum_amount: string; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewMaximum { @@ -18539,12 +19438,19 @@ export namespace SubscriptionSchedulePlanChangeParams { applies_to_price_ids: Array; maximum_amount: string; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } } export interface AddPrice { /** - * The subscription's discounts for this price. + * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * discounts for this price. */ discounts?: Array | null; @@ -18561,12 +19467,14 @@ export namespace SubscriptionSchedulePlanChangeParams { external_price_id?: string | null; /** - * The subscription's maximum amount for this price. + * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * maximum amount for this price. */ maximum_amount?: string | null; /** - * The subscription's minimum amount for this price. + * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * minimum amount for this price. */ minimum_amount?: string | null; @@ -20996,6 +21904,7 @@ export namespace SubscriptionSchedulePlanChangeParams { */ adjustment: | ReplaceAdjustment.NewPercentageDiscount + | ReplaceAdjustment.NewUsageDiscount | ReplaceAdjustment.NewAmountDiscount | ReplaceAdjustment.NewMinimum | ReplaceAdjustment.NewMaximum; @@ -21016,6 +21925,29 @@ export namespace SubscriptionSchedulePlanChangeParams { applies_to_price_ids: Array; percentage_discount: number; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; + } + + export interface NewUsageDiscount { + adjustment_type: 'usage_discount'; + + /** + * The set of price IDs to which this adjustment applies. + */ + applies_to_price_ids: Array; + + usage_discount: number; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewAmountDiscount { @@ -21027,6 +21959,12 @@ export namespace SubscriptionSchedulePlanChangeParams { * The set of price IDs to which this adjustment applies. */ applies_to_price_ids: Array; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewMinimum { @@ -21043,6 +21981,12 @@ export namespace SubscriptionSchedulePlanChangeParams { item_id: string; minimum_amount: string; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } export interface NewMaximum { @@ -21054,6 +21998,12 @@ export namespace SubscriptionSchedulePlanChangeParams { applies_to_price_ids: Array; maximum_amount: string; + + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + is_invoice_level?: boolean; } } @@ -21064,7 +22014,8 @@ export namespace SubscriptionSchedulePlanChangeParams { replaces_price_id: string; /** - * The subscription's discounts for the replacement price. + * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * discounts for the replacement price. */ discounts?: Array | null; @@ -21079,12 +22030,14 @@ export namespace SubscriptionSchedulePlanChangeParams { fixed_price_quantity?: number | null; /** - * The subscription's maximum amount for the replacement price. + * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * maximum amount for the replacement price. */ maximum_amount?: string | null; /** - * The subscription's minimum amount for the replacement price. + * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * minimum amount for the replacement price. */ minimum_amount?: string | null; diff --git a/src/version.ts b/src/version.ts index 33019f3d..e36007fb 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.37.0'; // x-release-please-version +export const VERSION = '4.38.0'; // x-release-please-version diff --git a/tests/api-resources/subscriptions.test.ts b/tests/api-resources/subscriptions.test.ts index 796d8b3e..5d5f62da 100644 --- a/tests/api-resources/subscriptions.test.ts +++ b/tests/api-resources/subscriptions.test.ts @@ -254,6 +254,7 @@ describe('resource subscriptions', () => { adjustment_type: 'percentage_discount', applies_to_price_ids: ['price_1', 'price_2'], percentage_discount: 0, + is_invoice_level: true, }, end_date: '2019-12-27T18:11:19.117Z', plan_phase_order: 0, @@ -306,6 +307,7 @@ describe('resource subscriptions', () => { credits_overage_rate: 0, default_invoice_memo: 'default_invoice_memo', external_plan_id: 'ZMwNQefe7J3ecf7W', + filter: "my_property > 100 AND my_other_property = 'bar'", initial_phase_order: 2, invoicing_threshold: '10.00', net_terms: 0, @@ -321,6 +323,7 @@ describe('resource subscriptions', () => { adjustment_type: 'percentage_discount', applies_to_price_ids: ['price_1', 'price_2'], percentage_discount: 0, + is_invoice_level: true, }, replaces_adjustment_id: 'replaces_adjustment_id', },