@openmeter/client 1.0.0-beta-75dd3b9ccc98 → 1.0.0-beta-471c6cd3d433

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1917,46 +1917,6 @@ export interface RateCardProrationConfiguration {
1917
1917
  /** The proration mode of the rate card. */
1918
1918
  mode: 'no_proration' | 'prorate_prices';
1919
1919
  }
1920
- /** Subscription create request. */
1921
- export interface SubscriptionCreate {
1922
- labels?: Labels;
1923
- /**
1924
- * Settlement mode for billing.
1925
- *
1926
- * Values:
1927
- *
1928
- * - `credit_then_invoice`: Credits are applied first, then any remainder is
1929
- * invoiced.
1930
- * - `credit_only`: Usage is settled exclusively against credits.
1931
- */
1932
- settlementMode?: 'credit_then_invoice' | 'credit_only';
1933
- /** The customer to create the subscription for. */
1934
- customer: {
1935
- id?: string;
1936
- key?: string;
1937
- };
1938
- /** The plan reference of the subscription. */
1939
- plan: {
1940
- id?: string;
1941
- key?: string;
1942
- version?: number;
1943
- };
1944
- /**
1945
- * A billing anchor is the fixed point in time that determines the subscription's
1946
- * recurring billing cycle. It affects when charges occur and how prorations are
1947
- * calculated. Common anchors:
1948
- *
1949
- * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
1950
- * - Subscription anniversary (day customer signed up)
1951
- * - Custom date (customer-specified day)
1952
- *
1953
- * If not provided, the subscription will be created with the subscription's
1954
- * creation time as the billing anchor.
1955
- */
1956
- billingAnchor?: Date;
1957
- /** Controls how custom-currency cost bases are selected for the subscription. */
1958
- costBasisMode: 'dynamic' | 'pinned';
1959
- }
1960
1920
  /**
1961
1921
  * Unit conversion configuration.
1962
1922
  *
@@ -3220,52 +3180,6 @@ export interface SubscriptionCancel {
3220
3180
  /** If not provided the subscription is canceled immediately. */
3221
3181
  timing: SubscriptionEditTiming;
3222
3182
  }
3223
- /** Request for changing a subscription. */
3224
- export interface SubscriptionChange {
3225
- labels?: Labels;
3226
- /**
3227
- * Settlement mode for billing.
3228
- *
3229
- * Values:
3230
- *
3231
- * - `credit_then_invoice`: Credits are applied first, then any remainder is
3232
- * invoiced.
3233
- * - `credit_only`: Usage is settled exclusively against credits.
3234
- */
3235
- settlementMode?: 'credit_then_invoice' | 'credit_only';
3236
- /** The customer to create the subscription for. */
3237
- customer: {
3238
- id?: string;
3239
- key?: string;
3240
- };
3241
- /** The plan reference of the subscription. */
3242
- plan: {
3243
- id?: string;
3244
- key?: string;
3245
- version?: number;
3246
- };
3247
- /**
3248
- * A billing anchor is the fixed point in time that determines the subscription's
3249
- * recurring billing cycle. It affects when charges occur and how prorations are
3250
- * calculated. Common anchors:
3251
- *
3252
- * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
3253
- * - Subscription anniversary (day customer signed up)
3254
- * - Custom date (customer-specified day)
3255
- *
3256
- * If not provided, the subscription will be created with the subscription's
3257
- * creation time as the billing anchor.
3258
- */
3259
- billingAnchor?: Date;
3260
- /** Controls how custom-currency cost bases are selected for the subscription. */
3261
- costBasisMode: 'dynamic' | 'pinned';
3262
- /**
3263
- * Timing configuration for the change, when the change should take effect. For
3264
- * changing a subscription, the accepted values depend on the subscription
3265
- * configuration.
3266
- */
3267
- timing: SubscriptionEditTiming;
3268
- }
3269
3183
  /** SubscriptionAddon create request. */
3270
3184
  export interface CreateSubscriptionAddonRequest {
3271
3185
  labels?: Labels;
@@ -4809,25 +4723,6 @@ export interface SubscriptionItem {
4809
4723
  /** The rate card describing what the customer gets and pays for this item. */
4810
4724
  rateCard: RateCard;
4811
4725
  }
4812
- /**
4813
- * Add a new rate card to a phase. Adding an item to the current phase closes the
4814
- * active version of the same item key and appends a new version.
4815
- */
4816
- export interface SubscriptionEditAddItem {
4817
- /** Discriminator for the add-item operation. */
4818
- type: 'add_item';
4819
- /** The key of the phase to add the item to. */
4820
- phaseKey: string;
4821
- /** The rate card describing what the customer gets and pays for the new item. */
4822
- rateCard: RateCard;
4823
- }
4824
- /** A rate card for a subscription add-on. */
4825
- export interface SubscriptionAddonRateCard {
4826
- /** The rate card. */
4827
- rateCard: RateCard;
4828
- /** The IDs of the subscription items that this rate card belongs to. */
4829
- affectedSubscriptionItemIds: string[];
4830
- }
4831
4726
  /**
4832
4727
  * The plan phase or pricing ramp allows changing a plan's rate cards over time as
4833
4728
  * a subscription progresses.
@@ -4855,6 +4750,25 @@ export interface PlanPhase {
4855
4750
  /** The rate cards of the plan. */
4856
4751
  rateCards: RateCard[];
4857
4752
  }
4753
+ /**
4754
+ * Add a new rate card to a phase. Adding an item to the current phase closes the
4755
+ * active version of the same item key and appends a new version.
4756
+ */
4757
+ export interface SubscriptionEditAddItem {
4758
+ /** Discriminator for the add-item operation. */
4759
+ type: 'add_item';
4760
+ /** The key of the phase to add the item to. */
4761
+ phaseKey: string;
4762
+ /** The rate card describing what the customer gets and pays for the new item. */
4763
+ rateCard: RateCard;
4764
+ }
4765
+ /** A rate card for a subscription add-on. */
4766
+ export interface SubscriptionAddonRateCard {
4767
+ /** The rate card. */
4768
+ rateCard: RateCard;
4769
+ /** The IDs of the subscription items that this rate card belongs to. */
4770
+ affectedSubscriptionItemIds: string[];
4771
+ }
4858
4772
  /**
4859
4773
  * Add-on allows extending subscriptions with compatible plans with additional
4860
4774
  * ratecards.
@@ -5272,16 +5186,12 @@ export interface SubscriptionPhase {
5272
5186
  */
5273
5187
  items: SubscriptionItem[];
5274
5188
  }
5275
- /** Addon purchased with a subscription. */
5276
- export interface SubscriptionAddon {
5277
- id: string;
5278
- labels?: Labels;
5279
- /** An ISO-8601 timestamp representation of entity creation date. */
5280
- createdAt: Date;
5281
- /** An ISO-8601 timestamp representation of entity last update date. */
5282
- updatedAt: Date;
5283
- /** An ISO-8601 timestamp representation of entity deletion date. */
5284
- deletedAt?: Date;
5189
+ /**
5190
+ * An inline (custom) plan definition used to create or change a subscription
5191
+ * without referencing a published plan. Mirrors the plan create shape without a
5192
+ * key or version, since a custom plan is not persisted or versioned on its own.
5193
+ */
5194
+ export interface SubscriptionCustomPlan {
5285
5195
  /**
5286
5196
  * Display name of the resource.
5287
5197
  *
@@ -5294,23 +5204,18 @@ export interface SubscriptionAddon {
5294
5204
  * Maximum 1024 characters.
5295
5205
  */
5296
5206
  description?: string;
5297
- /** The add-on associated with the subscription. */
5298
- addon: AddonReference;
5299
- /** The quantity of the add-on. Always 1 for single instance add-ons. */
5300
- quantity: number;
5207
+ labels?: Labels;
5208
+ /** The currency code of the plan. */
5209
+ currency: BillingCurrencyCode;
5210
+ /** The billing cadence for subscriptions using this plan. */
5211
+ billingCadence: string;
5212
+ /** Whether pro-rating is enabled for this plan. */
5213
+ proRatingEnabled: boolean;
5301
5214
  /**
5302
- * An ISO-8601 timestamp representation of which point in time the quantity was
5303
- * resolved to.
5215
+ * The plan phases define the pricing ramp for a subscription. A phase switch
5216
+ * occurs only at the end of a billing period. At least one phase is required.
5304
5217
  */
5305
- quantityAt: Date;
5306
- /** An ISO-8601 timestamp representation of the cadence start of the resource. */
5307
- activeFrom: Date;
5308
- /** An ISO-8601 timestamp representation of the cadence end of the resource. */
5309
- activeTo?: Date;
5310
- /** The timeline of the add-on. The returned periods are sorted and continuous. */
5311
- timeline: SubscriptionAddonTimelineSegment[];
5312
- /** The rate cards of the add-on. */
5313
- rateCards: SubscriptionAddonRateCard[];
5218
+ phases: PlanPhase[];
5314
5219
  }
5315
5220
  /** Plans provide a template for subscriptions. */
5316
5221
  export interface Plan {
@@ -5448,6 +5353,46 @@ export interface UpsertPlanRequest {
5448
5353
  */
5449
5354
  phases: PlanPhase[];
5450
5355
  }
5356
+ /** Addon purchased with a subscription. */
5357
+ export interface SubscriptionAddon {
5358
+ id: string;
5359
+ labels?: Labels;
5360
+ /** An ISO-8601 timestamp representation of entity creation date. */
5361
+ createdAt: Date;
5362
+ /** An ISO-8601 timestamp representation of entity last update date. */
5363
+ updatedAt: Date;
5364
+ /** An ISO-8601 timestamp representation of entity deletion date. */
5365
+ deletedAt?: Date;
5366
+ /**
5367
+ * Display name of the resource.
5368
+ *
5369
+ * Between 1 and 256 characters.
5370
+ */
5371
+ name: string;
5372
+ /**
5373
+ * Optional description of the resource.
5374
+ *
5375
+ * Maximum 1024 characters.
5376
+ */
5377
+ description?: string;
5378
+ /** The add-on associated with the subscription. */
5379
+ addon: AddonReference;
5380
+ /** The quantity of the add-on. Always 1 for single instance add-ons. */
5381
+ quantity: number;
5382
+ /**
5383
+ * An ISO-8601 timestamp representation of which point in time the quantity was
5384
+ * resolved to.
5385
+ */
5386
+ quantityAt: Date;
5387
+ /** An ISO-8601 timestamp representation of the cadence start of the resource. */
5388
+ activeFrom: Date;
5389
+ /** An ISO-8601 timestamp representation of the cadence end of the resource. */
5390
+ activeTo?: Date;
5391
+ /** The timeline of the add-on. The returned periods are sorted and continuous. */
5392
+ timeline: SubscriptionAddonTimelineSegment[];
5393
+ /** The rate cards of the add-on. */
5394
+ rateCards: SubscriptionAddonRateCard[];
5395
+ }
5451
5396
  /** Page paginated response. */
5452
5397
  export interface AddonPagePaginatedResponse {
5453
5398
  data: Addon[];
@@ -5544,56 +5489,169 @@ export interface Subscription {
5544
5489
  */
5545
5490
  phases: SubscriptionPhase[];
5546
5491
  }
5547
- /**
5548
- * Request for editing a running subscription. Applies an ordered batch of
5549
- * customizations to the subscription's phases and items. A later customization
5550
- * observes the state produced by earlier ones.
5551
- */
5552
- export interface SubscriptionEdit {
5553
- /** The ordered batch of customizations to apply to the running subscription. */
5554
- customizations: SubscriptionEditOperation[];
5555
- /** When the requested changes should take effect. Defaults to immediate. */
5556
- timing: SubscriptionEditTiming;
5557
- }
5558
- /** Page paginated response. */
5559
- export interface SubscriptionAddonPagePaginatedResponse {
5560
- data: SubscriptionAddon[];
5561
- meta: PaginatedMeta;
5562
- }
5563
- /** Page paginated response. */
5564
- export interface PlanPagePaginatedResponse {
5565
- data: Plan[];
5566
- meta: PaginatedMeta;
5567
- }
5568
- /** A standard invoice for charges owed by the customer. */
5569
- export interface InvoiceStandard {
5570
- id: string;
5492
+ export interface SubscriptionCreate {
5493
+ labels?: Labels;
5571
5494
  /**
5572
- * Optional description of the resource.
5495
+ * Settlement mode for billing.
5573
5496
  *
5574
- * Maximum 1024 characters.
5497
+ * Values:
5498
+ *
5499
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
5500
+ * invoiced.
5501
+ * - `credit_only`: Usage is settled exclusively against credits.
5575
5502
  */
5576
- description?: string;
5577
- labels?: Labels;
5578
- /** An ISO-8601 timestamp representation of entity creation date. */
5579
- createdAt: Date;
5580
- /** An ISO-8601 timestamp representation of entity last update date. */
5581
- updatedAt: Date;
5582
- /** An ISO-8601 timestamp representation of entity deletion date. */
5583
- deletedAt?: Date;
5584
- /** Human-readable invoice number generated by the invoicing app. */
5585
- number: string;
5586
- /** Three-letter ISO 4217 currency code for the invoice. */
5587
- currency: string;
5503
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
5504
+ /** The customer to create the subscription for. */
5505
+ customer: {
5506
+ id?: string;
5507
+ key?: string;
5508
+ };
5588
5509
  /**
5589
- * Snapshot of the supplier's contact information at the time the invoice was
5590
- * issued.
5510
+ * A reference to a published plan the subscription is created from.
5511
+ *
5512
+ * Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the
5513
+ * subscription on an existing published plan; use `custom_plan` to define the plan
5514
+ * inline.
5591
5515
  */
5592
- supplier: Supplier;
5593
- /** Snapshot of the customer's information at the time the invoice was issued. */
5594
- customer: InvoiceCustomer;
5595
- /** Aggregated financial totals for the invoice. */
5596
- totals: Totals;
5516
+ plan?: {
5517
+ id?: string;
5518
+ key?: string;
5519
+ version?: number;
5520
+ };
5521
+ /**
5522
+ * An inline plan definition to create the subscription from, without referencing a
5523
+ * published plan.
5524
+ *
5525
+ * Exactly one of `plan` or `custom_plan` must be provided. The subscription is not
5526
+ * linked to a persisted plan, so the response omits the `plan` reference.
5527
+ */
5528
+ customPlan?: SubscriptionCustomPlan;
5529
+ /**
5530
+ * A billing anchor is the fixed point in time that determines the subscription's
5531
+ * recurring billing cycle. It affects when charges occur and how prorations are
5532
+ * calculated. Common anchors:
5533
+ *
5534
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
5535
+ * - Subscription anniversary (day customer signed up)
5536
+ * - Custom date (customer-specified day)
5537
+ *
5538
+ * If not provided, the subscription will be created with the subscription's
5539
+ * creation time as the billing anchor.
5540
+ */
5541
+ billingAnchor?: Date;
5542
+ /** Controls how custom-currency cost bases are selected for the subscription. */
5543
+ costBasisMode: 'dynamic' | 'pinned';
5544
+ }
5545
+ /** Request for changing a subscription. */
5546
+ export interface SubscriptionChange {
5547
+ labels?: Labels;
5548
+ /**
5549
+ * Settlement mode for billing.
5550
+ *
5551
+ * Values:
5552
+ *
5553
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
5554
+ * invoiced.
5555
+ * - `credit_only`: Usage is settled exclusively against credits.
5556
+ */
5557
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
5558
+ /** The customer to create the subscription for. */
5559
+ customer: {
5560
+ id?: string;
5561
+ key?: string;
5562
+ };
5563
+ /**
5564
+ * A reference to a published plan the subscription is created from.
5565
+ *
5566
+ * Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the
5567
+ * subscription on an existing published plan; use `custom_plan` to define the plan
5568
+ * inline.
5569
+ */
5570
+ plan?: {
5571
+ id?: string;
5572
+ key?: string;
5573
+ version?: number;
5574
+ };
5575
+ /**
5576
+ * An inline plan definition to create the subscription from, without referencing a
5577
+ * published plan.
5578
+ *
5579
+ * Exactly one of `plan` or `custom_plan` must be provided. The subscription is not
5580
+ * linked to a persisted plan, so the response omits the `plan` reference.
5581
+ */
5582
+ customPlan?: SubscriptionCustomPlan;
5583
+ /**
5584
+ * A billing anchor is the fixed point in time that determines the subscription's
5585
+ * recurring billing cycle. It affects when charges occur and how prorations are
5586
+ * calculated. Common anchors:
5587
+ *
5588
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
5589
+ * - Subscription anniversary (day customer signed up)
5590
+ * - Custom date (customer-specified day)
5591
+ *
5592
+ * If not provided, the subscription will be created with the subscription's
5593
+ * creation time as the billing anchor.
5594
+ */
5595
+ billingAnchor?: Date;
5596
+ /** Controls how custom-currency cost bases are selected for the subscription. */
5597
+ costBasisMode: 'dynamic' | 'pinned';
5598
+ /**
5599
+ * Timing configuration for the change, when the change should take effect. For
5600
+ * changing a subscription, the accepted values depend on the subscription
5601
+ * configuration.
5602
+ */
5603
+ timing: SubscriptionEditTiming;
5604
+ }
5605
+ /** Page paginated response. */
5606
+ export interface PlanPagePaginatedResponse {
5607
+ data: Plan[];
5608
+ meta: PaginatedMeta;
5609
+ }
5610
+ /**
5611
+ * Request for editing a running subscription. Applies an ordered batch of
5612
+ * customizations to the subscription's phases and items. A later customization
5613
+ * observes the state produced by earlier ones.
5614
+ */
5615
+ export interface SubscriptionEdit {
5616
+ /** The ordered batch of customizations to apply to the running subscription. */
5617
+ customizations: SubscriptionEditOperation[];
5618
+ /** When the requested changes should take effect. Defaults to immediate. */
5619
+ timing: SubscriptionEditTiming;
5620
+ }
5621
+ /** Page paginated response. */
5622
+ export interface SubscriptionAddonPagePaginatedResponse {
5623
+ data: SubscriptionAddon[];
5624
+ meta: PaginatedMeta;
5625
+ }
5626
+ /** A standard invoice for charges owed by the customer. */
5627
+ export interface InvoiceStandard {
5628
+ id: string;
5629
+ /**
5630
+ * Optional description of the resource.
5631
+ *
5632
+ * Maximum 1024 characters.
5633
+ */
5634
+ description?: string;
5635
+ labels?: Labels;
5636
+ /** An ISO-8601 timestamp representation of entity creation date. */
5637
+ createdAt: Date;
5638
+ /** An ISO-8601 timestamp representation of entity last update date. */
5639
+ updatedAt: Date;
5640
+ /** An ISO-8601 timestamp representation of entity deletion date. */
5641
+ deletedAt?: Date;
5642
+ /** Human-readable invoice number generated by the invoicing app. */
5643
+ number: string;
5644
+ /** Three-letter ISO 4217 currency code for the invoice. */
5645
+ currency: string;
5646
+ /**
5647
+ * Snapshot of the supplier's contact information at the time the invoice was
5648
+ * issued.
5649
+ */
5650
+ supplier: Supplier;
5651
+ /** Snapshot of the customer's information at the time the invoice was issued. */
5652
+ customer: InvoiceCustomer;
5653
+ /** Aggregated financial totals for the invoice. */
5654
+ totals: Totals;
5597
5655
  /**
5598
5656
  * The service period covered by this invoice.
5599
5657
  *
@@ -6341,46 +6399,6 @@ export interface VoidCreditGrantRequestInput {
6341
6399
  */
6342
6400
  paymentAdjustment?: 'none';
6343
6401
  }
6344
- /** Subscription create request. */
6345
- export interface SubscriptionCreateInput {
6346
- labels?: Labels;
6347
- /**
6348
- * Settlement mode for billing.
6349
- *
6350
- * Values:
6351
- *
6352
- * - `credit_then_invoice`: Credits are applied first, then any remainder is
6353
- * invoiced.
6354
- * - `credit_only`: Usage is settled exclusively against credits.
6355
- */
6356
- settlementMode?: 'credit_then_invoice' | 'credit_only';
6357
- /** The customer to create the subscription for. */
6358
- customer: {
6359
- id?: string;
6360
- key?: string;
6361
- };
6362
- /** The plan reference of the subscription. */
6363
- plan: {
6364
- id?: string;
6365
- key?: string;
6366
- version?: number;
6367
- };
6368
- /**
6369
- * A billing anchor is the fixed point in time that determines the subscription's
6370
- * recurring billing cycle. It affects when charges occur and how prorations are
6371
- * calculated. Common anchors:
6372
- *
6373
- * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
6374
- * - Subscription anniversary (day customer signed up)
6375
- * - Custom date (customer-specified day)
6376
- *
6377
- * If not provided, the subscription will be created with the subscription's
6378
- * creation time as the billing anchor.
6379
- */
6380
- billingAnchor?: Date;
6381
- /** Controls how custom-currency cost bases are selected for the subscription. */
6382
- costBasisMode?: 'dynamic' | 'pinned';
6383
- }
6384
6402
  /**
6385
6403
  * Unit conversion configuration.
6386
6404
  *
@@ -6493,52 +6511,6 @@ export interface SubscriptionCancelInput {
6493
6511
  /** If not provided the subscription is canceled immediately. */
6494
6512
  timing?: SubscriptionEditTiming;
6495
6513
  }
6496
- /** Request for changing a subscription. */
6497
- export interface SubscriptionChangeInput {
6498
- labels?: Labels;
6499
- /**
6500
- * Settlement mode for billing.
6501
- *
6502
- * Values:
6503
- *
6504
- * - `credit_then_invoice`: Credits are applied first, then any remainder is
6505
- * invoiced.
6506
- * - `credit_only`: Usage is settled exclusively against credits.
6507
- */
6508
- settlementMode?: 'credit_then_invoice' | 'credit_only';
6509
- /** The customer to create the subscription for. */
6510
- customer: {
6511
- id?: string;
6512
- key?: string;
6513
- };
6514
- /** The plan reference of the subscription. */
6515
- plan: {
6516
- id?: string;
6517
- key?: string;
6518
- version?: number;
6519
- };
6520
- /**
6521
- * A billing anchor is the fixed point in time that determines the subscription's
6522
- * recurring billing cycle. It affects when charges occur and how prorations are
6523
- * calculated. Common anchors:
6524
- *
6525
- * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
6526
- * - Subscription anniversary (day customer signed up)
6527
- * - Custom date (customer-specified day)
6528
- *
6529
- * If not provided, the subscription will be created with the subscription's
6530
- * creation time as the billing anchor.
6531
- */
6532
- billingAnchor?: Date;
6533
- /** Controls how custom-currency cost bases are selected for the subscription. */
6534
- costBasisMode?: 'dynamic' | 'pinned';
6535
- /**
6536
- * Timing configuration for the change, when the change should take effect. For
6537
- * changing a subscription, the accepted values depend on the subscription
6538
- * configuration.
6539
- */
6540
- timing: SubscriptionEditTiming;
6541
- }
6542
6514
  /**
6543
6515
  * Invoice-level snapshot of the workflow configuration.
6544
6516
  *
@@ -7238,25 +7210,6 @@ export interface SubscriptionItemInput {
7238
7210
  /** The rate card describing what the customer gets and pays for this item. */
7239
7211
  rateCard: RateCardInput;
7240
7212
  }
7241
- /**
7242
- * Add a new rate card to a phase. Adding an item to the current phase closes the
7243
- * active version of the same item key and appends a new version.
7244
- */
7245
- export interface SubscriptionEditAddItemInput {
7246
- /** Discriminator for the add-item operation. */
7247
- type: 'add_item';
7248
- /** The key of the phase to add the item to. */
7249
- phaseKey: string;
7250
- /** The rate card describing what the customer gets and pays for the new item. */
7251
- rateCard: RateCardInput;
7252
- }
7253
- /** A rate card for a subscription add-on. */
7254
- export interface SubscriptionAddonRateCardInput {
7255
- /** The rate card. */
7256
- rateCard: RateCardInput;
7257
- /** The IDs of the subscription items that this rate card belongs to. */
7258
- affectedSubscriptionItemIds: string[];
7259
- }
7260
7213
  /**
7261
7214
  * The plan phase or pricing ramp allows changing a plan's rate cards over time as
7262
7215
  * a subscription progresses.
@@ -7284,6 +7237,25 @@ export interface PlanPhaseInput {
7284
7237
  /** The rate cards of the plan. */
7285
7238
  rateCards: RateCardInput[];
7286
7239
  }
7240
+ /**
7241
+ * Add a new rate card to a phase. Adding an item to the current phase closes the
7242
+ * active version of the same item key and appends a new version.
7243
+ */
7244
+ export interface SubscriptionEditAddItemInput {
7245
+ /** Discriminator for the add-item operation. */
7246
+ type: 'add_item';
7247
+ /** The key of the phase to add the item to. */
7248
+ phaseKey: string;
7249
+ /** The rate card describing what the customer gets and pays for the new item. */
7250
+ rateCard: RateCardInput;
7251
+ }
7252
+ /** A rate card for a subscription add-on. */
7253
+ export interface SubscriptionAddonRateCardInput {
7254
+ /** The rate card. */
7255
+ rateCard: RateCardInput;
7256
+ /** The IDs of the subscription items that this rate card belongs to. */
7257
+ affectedSubscriptionItemIds: string[];
7258
+ }
7287
7259
  /**
7288
7260
  * Add-on allows extending subscriptions with compatible plans with additional
7289
7261
  * ratecards.
@@ -7659,16 +7631,12 @@ export interface SubscriptionPhaseInput {
7659
7631
  */
7660
7632
  items: SubscriptionItemInput[];
7661
7633
  }
7662
- /** Addon purchased with a subscription. */
7663
- export interface SubscriptionAddonInput {
7664
- id: string;
7665
- labels?: Labels;
7666
- /** An ISO-8601 timestamp representation of entity creation date. */
7667
- createdAt: Date;
7668
- /** An ISO-8601 timestamp representation of entity last update date. */
7669
- updatedAt: Date;
7670
- /** An ISO-8601 timestamp representation of entity deletion date. */
7671
- deletedAt?: Date;
7634
+ /**
7635
+ * An inline (custom) plan definition used to create or change a subscription
7636
+ * without referencing a published plan. Mirrors the plan create shape without a
7637
+ * key or version, since a custom plan is not persisted or versioned on its own.
7638
+ */
7639
+ export interface SubscriptionCustomPlanInput {
7672
7640
  /**
7673
7641
  * Display name of the resource.
7674
7642
  *
@@ -7681,23 +7649,18 @@ export interface SubscriptionAddonInput {
7681
7649
  * Maximum 1024 characters.
7682
7650
  */
7683
7651
  description?: string;
7684
- /** The add-on associated with the subscription. */
7685
- addon: AddonReference;
7686
- /** The quantity of the add-on. Always 1 for single instance add-ons. */
7687
- quantity: number;
7652
+ labels?: Labels;
7653
+ /** The currency code of the plan. */
7654
+ currency: BillingCurrencyCode;
7655
+ /** The billing cadence for subscriptions using this plan. */
7656
+ billingCadence: string;
7657
+ /** Whether pro-rating is enabled for this plan. */
7658
+ proRatingEnabled?: boolean;
7688
7659
  /**
7689
- * An ISO-8601 timestamp representation of which point in time the quantity was
7690
- * resolved to.
7660
+ * The plan phases define the pricing ramp for a subscription. A phase switch
7661
+ * occurs only at the end of a billing period. At least one phase is required.
7691
7662
  */
7692
- quantityAt: Date;
7693
- /** An ISO-8601 timestamp representation of the cadence start of the resource. */
7694
- activeFrom: Date;
7695
- /** An ISO-8601 timestamp representation of the cadence end of the resource. */
7696
- activeTo?: Date;
7697
- /** The timeline of the add-on. The returned periods are sorted and continuous. */
7698
- timeline: SubscriptionAddonTimelineSegment[];
7699
- /** The rate cards of the add-on. */
7700
- rateCards: SubscriptionAddonRateCardInput[];
7663
+ phases: PlanPhaseInput[];
7701
7664
  }
7702
7665
  /** Plans provide a template for subscriptions. */
7703
7666
  export interface PlanInput {
@@ -7835,6 +7798,46 @@ export interface UpsertPlanRequestInput {
7835
7798
  */
7836
7799
  phases: PlanPhaseInput[];
7837
7800
  }
7801
+ /** Addon purchased with a subscription. */
7802
+ export interface SubscriptionAddonInput {
7803
+ id: string;
7804
+ labels?: Labels;
7805
+ /** An ISO-8601 timestamp representation of entity creation date. */
7806
+ createdAt: Date;
7807
+ /** An ISO-8601 timestamp representation of entity last update date. */
7808
+ updatedAt: Date;
7809
+ /** An ISO-8601 timestamp representation of entity deletion date. */
7810
+ deletedAt?: Date;
7811
+ /**
7812
+ * Display name of the resource.
7813
+ *
7814
+ * Between 1 and 256 characters.
7815
+ */
7816
+ name: string;
7817
+ /**
7818
+ * Optional description of the resource.
7819
+ *
7820
+ * Maximum 1024 characters.
7821
+ */
7822
+ description?: string;
7823
+ /** The add-on associated with the subscription. */
7824
+ addon: AddonReference;
7825
+ /** The quantity of the add-on. Always 1 for single instance add-ons. */
7826
+ quantity: number;
7827
+ /**
7828
+ * An ISO-8601 timestamp representation of which point in time the quantity was
7829
+ * resolved to.
7830
+ */
7831
+ quantityAt: Date;
7832
+ /** An ISO-8601 timestamp representation of the cadence start of the resource. */
7833
+ activeFrom: Date;
7834
+ /** An ISO-8601 timestamp representation of the cadence end of the resource. */
7835
+ activeTo?: Date;
7836
+ /** The timeline of the add-on. The returned periods are sorted and continuous. */
7837
+ timeline: SubscriptionAddonTimelineSegment[];
7838
+ /** The rate cards of the add-on. */
7839
+ rateCards: SubscriptionAddonRateCardInput[];
7840
+ }
7838
7841
  /** Page paginated response. */
7839
7842
  export interface AddonPagePaginatedResponseInput {
7840
7843
  data: AddonInput[];
@@ -7931,6 +7934,124 @@ export interface SubscriptionInput {
7931
7934
  */
7932
7935
  phases: SubscriptionPhaseInput[];
7933
7936
  }
7937
+ export interface SubscriptionCreateInput {
7938
+ labels?: Labels;
7939
+ /**
7940
+ * Settlement mode for billing.
7941
+ *
7942
+ * Values:
7943
+ *
7944
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
7945
+ * invoiced.
7946
+ * - `credit_only`: Usage is settled exclusively against credits.
7947
+ */
7948
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
7949
+ /** The customer to create the subscription for. */
7950
+ customer: {
7951
+ id?: string;
7952
+ key?: string;
7953
+ };
7954
+ /**
7955
+ * A reference to a published plan the subscription is created from.
7956
+ *
7957
+ * Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the
7958
+ * subscription on an existing published plan; use `custom_plan` to define the plan
7959
+ * inline.
7960
+ */
7961
+ plan?: {
7962
+ id?: string;
7963
+ key?: string;
7964
+ version?: number;
7965
+ };
7966
+ /**
7967
+ * An inline plan definition to create the subscription from, without referencing a
7968
+ * published plan.
7969
+ *
7970
+ * Exactly one of `plan` or `custom_plan` must be provided. The subscription is not
7971
+ * linked to a persisted plan, so the response omits the `plan` reference.
7972
+ */
7973
+ customPlan?: SubscriptionCustomPlanInput;
7974
+ /**
7975
+ * A billing anchor is the fixed point in time that determines the subscription's
7976
+ * recurring billing cycle. It affects when charges occur and how prorations are
7977
+ * calculated. Common anchors:
7978
+ *
7979
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
7980
+ * - Subscription anniversary (day customer signed up)
7981
+ * - Custom date (customer-specified day)
7982
+ *
7983
+ * If not provided, the subscription will be created with the subscription's
7984
+ * creation time as the billing anchor.
7985
+ */
7986
+ billingAnchor?: Date;
7987
+ /** Controls how custom-currency cost bases are selected for the subscription. */
7988
+ costBasisMode?: 'dynamic' | 'pinned';
7989
+ }
7990
+ /** Request for changing a subscription. */
7991
+ export interface SubscriptionChangeInput {
7992
+ labels?: Labels;
7993
+ /**
7994
+ * Settlement mode for billing.
7995
+ *
7996
+ * Values:
7997
+ *
7998
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
7999
+ * invoiced.
8000
+ * - `credit_only`: Usage is settled exclusively against credits.
8001
+ */
8002
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
8003
+ /** The customer to create the subscription for. */
8004
+ customer: {
8005
+ id?: string;
8006
+ key?: string;
8007
+ };
8008
+ /**
8009
+ * A reference to a published plan the subscription is created from.
8010
+ *
8011
+ * Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the
8012
+ * subscription on an existing published plan; use `custom_plan` to define the plan
8013
+ * inline.
8014
+ */
8015
+ plan?: {
8016
+ id?: string;
8017
+ key?: string;
8018
+ version?: number;
8019
+ };
8020
+ /**
8021
+ * An inline plan definition to create the subscription from, without referencing a
8022
+ * published plan.
8023
+ *
8024
+ * Exactly one of `plan` or `custom_plan` must be provided. The subscription is not
8025
+ * linked to a persisted plan, so the response omits the `plan` reference.
8026
+ */
8027
+ customPlan?: SubscriptionCustomPlanInput;
8028
+ /**
8029
+ * A billing anchor is the fixed point in time that determines the subscription's
8030
+ * recurring billing cycle. It affects when charges occur and how prorations are
8031
+ * calculated. Common anchors:
8032
+ *
8033
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
8034
+ * - Subscription anniversary (day customer signed up)
8035
+ * - Custom date (customer-specified day)
8036
+ *
8037
+ * If not provided, the subscription will be created with the subscription's
8038
+ * creation time as the billing anchor.
8039
+ */
8040
+ billingAnchor?: Date;
8041
+ /** Controls how custom-currency cost bases are selected for the subscription. */
8042
+ costBasisMode?: 'dynamic' | 'pinned';
8043
+ /**
8044
+ * Timing configuration for the change, when the change should take effect. For
8045
+ * changing a subscription, the accepted values depend on the subscription
8046
+ * configuration.
8047
+ */
8048
+ timing: SubscriptionEditTiming;
8049
+ }
8050
+ /** Page paginated response. */
8051
+ export interface PlanPagePaginatedResponseInput {
8052
+ data: PlanInput[];
8053
+ meta: PaginatedMeta;
8054
+ }
7934
8055
  /**
7935
8056
  * Request for editing a running subscription. Applies an ordered batch of
7936
8057
  * customizations to the subscription's phases and items. A later customization
@@ -7947,11 +8068,6 @@ export interface SubscriptionAddonPagePaginatedResponseInput {
7947
8068
  data: SubscriptionAddonInput[];
7948
8069
  meta: PaginatedMeta;
7949
8070
  }
7950
- /** Page paginated response. */
7951
- export interface PlanPagePaginatedResponseInput {
7952
- data: PlanInput[];
7953
- meta: PaginatedMeta;
7954
- }
7955
8071
  /** A standard invoice for charges owed by the customer. */
7956
8072
  export interface InvoiceStandardInput {
7957
8073
  id: string;