@openmeter/client 1.0.0-beta-c39f92326e5b → 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.
@@ -236,6 +236,23 @@ export interface ChargeFlatFeeDiscounts {
236
236
  /** Percentage discount applied to the price (0–100). */
237
237
  percentage?: number;
238
238
  }
239
+ /** Remove a rate card from a phase. */
240
+ export interface SubscriptionEditRemoveItem {
241
+ /** Discriminator for the remove-item operation. */
242
+ type: 'remove_item';
243
+ /** The key of the phase to remove the item from. */
244
+ phaseKey: string;
245
+ /** The key of the item to remove. */
246
+ itemKey: string;
247
+ }
248
+ /**
249
+ * Discard any scheduled edits on the current phase, reverting it to its previously
250
+ * persisted state.
251
+ */
252
+ export interface SubscriptionEditUnscheduleEdit {
253
+ /** Discriminator for the unschedule-edit operation. */
254
+ type: 'unschedule_edit';
255
+ }
239
256
  /**
240
257
  * Labels store metadata of an entity that can be used for filtering an entity list
241
258
  * or for searching across entity types.
@@ -1782,6 +1799,34 @@ export interface RateCardMeteredEntitlement {
1782
1799
  */
1783
1800
  usagePeriod?: string;
1784
1801
  }
1802
+ /** The definition of a new subscription phase to add via an edit. */
1803
+ export interface SubscriptionPhaseCreate {
1804
+ /** A locally unique identifier for the phase. */
1805
+ key: string;
1806
+ /** The name of the phase. */
1807
+ name: string;
1808
+ /** An optional description of the phase. */
1809
+ description?: string;
1810
+ /**
1811
+ * The ISO-8601 interval after the subscription start at which the phase begins.
1812
+ * When null, the phase starts immediately after the subscription starts.
1813
+ */
1814
+ startAfter: string | null;
1815
+ /**
1816
+ * The intended ISO-8601 duration of the phase. Required unless the phase will be
1817
+ * the last phase of the subscription.
1818
+ */
1819
+ duration?: string;
1820
+ }
1821
+ /** Extend the duration of a phase, shifting later phases by the same amount. */
1822
+ export interface SubscriptionEditStretchPhase {
1823
+ /** Discriminator for the stretch-phase operation. */
1824
+ type: 'stretch_phase';
1825
+ /** The key of the phase to stretch. */
1826
+ phaseKey: string;
1827
+ /** The ISO-8601 duration to extend the phase by. */
1828
+ extendBy: string;
1829
+ }
1785
1830
  /** Recurring period with an anchor and an interval. */
1786
1831
  export interface RecurringPeriod {
1787
1832
  /** A date-time anchor to base the recurring period on. */
@@ -1872,46 +1917,6 @@ export interface RateCardProrationConfiguration {
1872
1917
  /** The proration mode of the rate card. */
1873
1918
  mode: 'no_proration' | 'prorate_prices';
1874
1919
  }
1875
- /** Subscription create request. */
1876
- export interface SubscriptionCreate {
1877
- labels?: Labels;
1878
- /**
1879
- * Settlement mode for billing.
1880
- *
1881
- * Values:
1882
- *
1883
- * - `credit_then_invoice`: Credits are applied first, then any remainder is
1884
- * invoiced.
1885
- * - `credit_only`: Usage is settled exclusively against credits.
1886
- */
1887
- settlementMode?: 'credit_then_invoice' | 'credit_only';
1888
- /** The customer to create the subscription for. */
1889
- customer: {
1890
- id?: string;
1891
- key?: string;
1892
- };
1893
- /** The plan reference of the subscription. */
1894
- plan: {
1895
- id?: string;
1896
- key?: string;
1897
- version?: number;
1898
- };
1899
- /**
1900
- * A billing anchor is the fixed point in time that determines the subscription's
1901
- * recurring billing cycle. It affects when charges occur and how prorations are
1902
- * calculated. Common anchors:
1903
- *
1904
- * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
1905
- * - Subscription anniversary (day customer signed up)
1906
- * - Custom date (customer-specified day)
1907
- *
1908
- * If not provided, the subscription will be created with the subscription's
1909
- * creation time as the billing anchor.
1910
- */
1911
- billingAnchor?: Date;
1912
- /** Controls how custom-currency cost bases are selected for the subscription. */
1913
- costBasisMode: 'dynamic' | 'pinned';
1914
- }
1915
1920
  /**
1916
1921
  * Unit conversion configuration.
1917
1922
  *
@@ -2032,6 +2037,15 @@ export interface ChargeRealizationPayment {
2032
2037
  /** The settlement status of the payment. */
2033
2038
  status: 'authorized' | 'settled';
2034
2039
  }
2040
+ /** Remove a phase from the subscription. */
2041
+ export interface SubscriptionEditRemovePhase {
2042
+ /** Discriminator for the remove-phase operation. */
2043
+ type: 'remove_phase';
2044
+ /** The key of the phase to remove. */
2045
+ phaseKey: string;
2046
+ /** The direction to shift surrounding phases to fill the removed phase's span. */
2047
+ shift: 'next' | 'prev';
2048
+ }
2035
2049
  /** Mapping of app types to tax codes. */
2036
2050
  export interface TaxCodeAppMapping {
2037
2051
  /** The app type that the tax code is associated with. */
@@ -3114,6 +3128,16 @@ export interface ListCustomerEntitlementAccessResponseData {
3114
3128
  /** The list of entitlement access results. */
3115
3129
  data: EntitlementAccessResult[];
3116
3130
  }
3131
+ /**
3132
+ * Add a new phase to the subscription. The phase is created without items; use
3133
+ * add-item operations to populate it.
3134
+ */
3135
+ export interface SubscriptionEditAddPhase {
3136
+ /** Discriminator for the add-phase operation. */
3137
+ type: 'add_phase';
3138
+ /** The phase to add. */
3139
+ phase: SubscriptionPhaseCreate;
3140
+ }
3117
3141
  /**
3118
3142
  * BillingWorkflowCollectionAlignmentAnchored specifies the alignment for
3119
3143
  * collecting the pending line items into an invoice.
@@ -3156,52 +3180,6 @@ export interface SubscriptionCancel {
3156
3180
  /** If not provided the subscription is canceled immediately. */
3157
3181
  timing: SubscriptionEditTiming;
3158
3182
  }
3159
- /** Request for changing a subscription. */
3160
- export interface SubscriptionChange {
3161
- labels?: Labels;
3162
- /**
3163
- * Settlement mode for billing.
3164
- *
3165
- * Values:
3166
- *
3167
- * - `credit_then_invoice`: Credits are applied first, then any remainder is
3168
- * invoiced.
3169
- * - `credit_only`: Usage is settled exclusively against credits.
3170
- */
3171
- settlementMode?: 'credit_then_invoice' | 'credit_only';
3172
- /** The customer to create the subscription for. */
3173
- customer: {
3174
- id?: string;
3175
- key?: string;
3176
- };
3177
- /** The plan reference of the subscription. */
3178
- plan: {
3179
- id?: string;
3180
- key?: string;
3181
- version?: number;
3182
- };
3183
- /**
3184
- * A billing anchor is the fixed point in time that determines the subscription's
3185
- * recurring billing cycle. It affects when charges occur and how prorations are
3186
- * calculated. Common anchors:
3187
- *
3188
- * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
3189
- * - Subscription anniversary (day customer signed up)
3190
- * - Custom date (customer-specified day)
3191
- *
3192
- * If not provided, the subscription will be created with the subscription's
3193
- * creation time as the billing anchor.
3194
- */
3195
- billingAnchor?: Date;
3196
- /** Controls how custom-currency cost bases are selected for the subscription. */
3197
- costBasisMode: 'dynamic' | 'pinned';
3198
- /**
3199
- * Timing configuration for the change, when the change should take effect. For
3200
- * changing a subscription, the accepted values depend on the subscription
3201
- * configuration.
3202
- */
3203
- timing: SubscriptionEditTiming;
3204
- }
3205
3183
  /** SubscriptionAddon create request. */
3206
3184
  export interface CreateSubscriptionAddonRequest {
3207
3185
  labels?: Labels;
@@ -4745,13 +4723,6 @@ export interface SubscriptionItem {
4745
4723
  /** The rate card describing what the customer gets and pays for this item. */
4746
4724
  rateCard: RateCard;
4747
4725
  }
4748
- /** A rate card for a subscription add-on. */
4749
- export interface SubscriptionAddonRateCard {
4750
- /** The rate card. */
4751
- rateCard: RateCard;
4752
- /** The IDs of the subscription items that this rate card belongs to. */
4753
- affectedSubscriptionItemIds: string[];
4754
- }
4755
4726
  /**
4756
4727
  * The plan phase or pricing ramp allows changing a plan's rate cards over time as
4757
4728
  * a subscription progresses.
@@ -4779,6 +4750,25 @@ export interface PlanPhase {
4779
4750
  /** The rate cards of the plan. */
4780
4751
  rateCards: RateCard[];
4781
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
+ }
4782
4772
  /**
4783
4773
  * Add-on allows extending subscriptions with compatible plans with additional
4784
4774
  * ratecards.
@@ -5196,16 +5186,12 @@ export interface SubscriptionPhase {
5196
5186
  */
5197
5187
  items: SubscriptionItem[];
5198
5188
  }
5199
- /** Addon purchased with a subscription. */
5200
- export interface SubscriptionAddon {
5201
- id: string;
5202
- labels?: Labels;
5203
- /** An ISO-8601 timestamp representation of entity creation date. */
5204
- createdAt: Date;
5205
- /** An ISO-8601 timestamp representation of entity last update date. */
5206
- updatedAt: Date;
5207
- /** An ISO-8601 timestamp representation of entity deletion date. */
5208
- 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 {
5209
5195
  /**
5210
5196
  * Display name of the resource.
5211
5197
  *
@@ -5218,23 +5204,18 @@ export interface SubscriptionAddon {
5218
5204
  * Maximum 1024 characters.
5219
5205
  */
5220
5206
  description?: string;
5221
- /** The add-on associated with the subscription. */
5222
- addon: AddonReference;
5223
- /** The quantity of the add-on. Always 1 for single instance add-ons. */
5224
- 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;
5225
5214
  /**
5226
- * An ISO-8601 timestamp representation of which point in time the quantity was
5227
- * 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.
5228
5217
  */
5229
- quantityAt: Date;
5230
- /** An ISO-8601 timestamp representation of the cadence start of the resource. */
5231
- activeFrom: Date;
5232
- /** An ISO-8601 timestamp representation of the cadence end of the resource. */
5233
- activeTo?: Date;
5234
- /** The timeline of the add-on. The returned periods are sorted and continuous. */
5235
- timeline: SubscriptionAddonTimelineSegment[];
5236
- /** The rate cards of the add-on. */
5237
- rateCards: SubscriptionAddonRateCard[];
5218
+ phases: PlanPhase[];
5238
5219
  }
5239
5220
  /** Plans provide a template for subscriptions. */
5240
5221
  export interface Plan {
@@ -5372,6 +5353,46 @@ export interface UpsertPlanRequest {
5372
5353
  */
5373
5354
  phases: PlanPhase[];
5374
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
+ }
5375
5396
  /** Page paginated response. */
5376
5397
  export interface AddonPagePaginatedResponse {
5377
5398
  data: Addon[];
@@ -5468,55 +5489,179 @@ export interface Subscription {
5468
5489
  */
5469
5490
  phases: SubscriptionPhase[];
5470
5491
  }
5471
- /** Page paginated response. */
5472
- export interface SubscriptionAddonPagePaginatedResponse {
5473
- data: SubscriptionAddon[];
5474
- meta: PaginatedMeta;
5475
- }
5476
- /** Page paginated response. */
5477
- export interface PlanPagePaginatedResponse {
5478
- data: Plan[];
5479
- meta: PaginatedMeta;
5480
- }
5481
- /** A standard invoice for charges owed by the customer. */
5482
- export interface InvoiceStandard {
5483
- id: string;
5492
+ export interface SubscriptionCreate {
5493
+ labels?: Labels;
5484
5494
  /**
5485
- * Optional description of the resource.
5495
+ * Settlement mode for billing.
5486
5496
  *
5487
- * 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.
5488
5502
  */
5489
- description?: string;
5490
- labels?: Labels;
5491
- /** An ISO-8601 timestamp representation of entity creation date. */
5492
- createdAt: Date;
5493
- /** An ISO-8601 timestamp representation of entity last update date. */
5494
- updatedAt: Date;
5495
- /** An ISO-8601 timestamp representation of entity deletion date. */
5496
- deletedAt?: Date;
5497
- /** Human-readable invoice number generated by the invoicing app. */
5498
- number: string;
5499
- /** Three-letter ISO 4217 currency code for the invoice. */
5500
- 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
+ };
5501
5509
  /**
5502
- * Snapshot of the supplier's contact information at the time the invoice was
5503
- * 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.
5504
5515
  */
5505
- supplier: Supplier;
5506
- /** Snapshot of the customer's information at the time the invoice was issued. */
5507
- customer: InvoiceCustomer;
5508
- /** Aggregated financial totals for the invoice. */
5509
- totals: Totals;
5516
+ plan?: {
5517
+ id?: string;
5518
+ key?: string;
5519
+ version?: number;
5520
+ };
5510
5521
  /**
5511
- * The service period covered by this invoice.
5522
+ * An inline plan definition to create the subscription from, without referencing a
5523
+ * published plan.
5512
5524
  *
5513
- * For flat fee the service period can be empty which means `from` will be equals
5514
- * to `to`. In other cases those fields will be filled with the actual service
5515
- * period.
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.
5516
5527
  */
5517
- servicePeriod: ClosedPeriod;
5528
+ customPlan?: SubscriptionCustomPlan;
5518
5529
  /**
5519
- * Validation issues found during invoice processing.
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;
5655
+ /**
5656
+ * The service period covered by this invoice.
5657
+ *
5658
+ * For flat fee the service period can be empty which means `from` will be equals
5659
+ * to `to`. In other cases those fields will be filled with the actual service
5660
+ * period.
5661
+ */
5662
+ servicePeriod: ClosedPeriod;
5663
+ /**
5664
+ * Validation issues found during invoice processing.
5520
5665
  *
5521
5666
  * Present only when there are one or more validation findings. An empty list is
5522
5667
  * omitted.
@@ -5953,6 +6098,11 @@ export type FeatureOrReference = Feature | FeatureReference;
5953
6098
  export type ChargeRealizationInvoiceOrReference = ChargeRealizationInvoice | ChargeRealizationInvoiceReference;
5954
6099
  /** Customer charge. */
5955
6100
  export type CreateChargeRequest = CreateChargeFlatFeeRequest | CreateChargeUsageBasedRequest;
6101
+ /**
6102
+ * A single customization to apply to a running subscription. The `type` field
6103
+ * discriminates which operation is performed.
6104
+ */
6105
+ export type SubscriptionEditOperation = SubscriptionEditAddItem | SubscriptionEditRemoveItem | SubscriptionEditAddPhase | SubscriptionEditRemovePhase | SubscriptionEditStretchPhase | SubscriptionEditUnscheduleEdit;
5956
6106
  /**
5957
6107
  * A top-level line item on an invoice.
5958
6108
  *
@@ -6249,46 +6399,6 @@ export interface VoidCreditGrantRequestInput {
6249
6399
  */
6250
6400
  paymentAdjustment?: 'none';
6251
6401
  }
6252
- /** Subscription create request. */
6253
- export interface SubscriptionCreateInput {
6254
- labels?: Labels;
6255
- /**
6256
- * Settlement mode for billing.
6257
- *
6258
- * Values:
6259
- *
6260
- * - `credit_then_invoice`: Credits are applied first, then any remainder is
6261
- * invoiced.
6262
- * - `credit_only`: Usage is settled exclusively against credits.
6263
- */
6264
- settlementMode?: 'credit_then_invoice' | 'credit_only';
6265
- /** The customer to create the subscription for. */
6266
- customer: {
6267
- id?: string;
6268
- key?: string;
6269
- };
6270
- /** The plan reference of the subscription. */
6271
- plan: {
6272
- id?: string;
6273
- key?: string;
6274
- version?: number;
6275
- };
6276
- /**
6277
- * A billing anchor is the fixed point in time that determines the subscription's
6278
- * recurring billing cycle. It affects when charges occur and how prorations are
6279
- * calculated. Common anchors:
6280
- *
6281
- * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
6282
- * - Subscription anniversary (day customer signed up)
6283
- * - Custom date (customer-specified day)
6284
- *
6285
- * If not provided, the subscription will be created with the subscription's
6286
- * creation time as the billing anchor.
6287
- */
6288
- billingAnchor?: Date;
6289
- /** Controls how custom-currency cost bases are selected for the subscription. */
6290
- costBasisMode?: 'dynamic' | 'pinned';
6291
- }
6292
6402
  /**
6293
6403
  * Unit conversion configuration.
6294
6404
  *
@@ -6401,52 +6511,6 @@ export interface SubscriptionCancelInput {
6401
6511
  /** If not provided the subscription is canceled immediately. */
6402
6512
  timing?: SubscriptionEditTiming;
6403
6513
  }
6404
- /** Request for changing a subscription. */
6405
- export interface SubscriptionChangeInput {
6406
- labels?: Labels;
6407
- /**
6408
- * Settlement mode for billing.
6409
- *
6410
- * Values:
6411
- *
6412
- * - `credit_then_invoice`: Credits are applied first, then any remainder is
6413
- * invoiced.
6414
- * - `credit_only`: Usage is settled exclusively against credits.
6415
- */
6416
- settlementMode?: 'credit_then_invoice' | 'credit_only';
6417
- /** The customer to create the subscription for. */
6418
- customer: {
6419
- id?: string;
6420
- key?: string;
6421
- };
6422
- /** The plan reference of the subscription. */
6423
- plan: {
6424
- id?: string;
6425
- key?: string;
6426
- version?: number;
6427
- };
6428
- /**
6429
- * A billing anchor is the fixed point in time that determines the subscription's
6430
- * recurring billing cycle. It affects when charges occur and how prorations are
6431
- * calculated. Common anchors:
6432
- *
6433
- * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
6434
- * - Subscription anniversary (day customer signed up)
6435
- * - Custom date (customer-specified day)
6436
- *
6437
- * If not provided, the subscription will be created with the subscription's
6438
- * creation time as the billing anchor.
6439
- */
6440
- billingAnchor?: Date;
6441
- /** Controls how custom-currency cost bases are selected for the subscription. */
6442
- costBasisMode?: 'dynamic' | 'pinned';
6443
- /**
6444
- * Timing configuration for the change, when the change should take effect. For
6445
- * changing a subscription, the accepted values depend on the subscription
6446
- * configuration.
6447
- */
6448
- timing: SubscriptionEditTiming;
6449
- }
6450
6514
  /**
6451
6515
  * Invoice-level snapshot of the workflow configuration.
6452
6516
  *
@@ -7146,13 +7210,6 @@ export interface SubscriptionItemInput {
7146
7210
  /** The rate card describing what the customer gets and pays for this item. */
7147
7211
  rateCard: RateCardInput;
7148
7212
  }
7149
- /** A rate card for a subscription add-on. */
7150
- export interface SubscriptionAddonRateCardInput {
7151
- /** The rate card. */
7152
- rateCard: RateCardInput;
7153
- /** The IDs of the subscription items that this rate card belongs to. */
7154
- affectedSubscriptionItemIds: string[];
7155
- }
7156
7213
  /**
7157
7214
  * The plan phase or pricing ramp allows changing a plan's rate cards over time as
7158
7215
  * a subscription progresses.
@@ -7180,6 +7237,25 @@ export interface PlanPhaseInput {
7180
7237
  /** The rate cards of the plan. */
7181
7238
  rateCards: RateCardInput[];
7182
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
+ }
7183
7259
  /**
7184
7260
  * Add-on allows extending subscriptions with compatible plans with additional
7185
7261
  * ratecards.
@@ -7555,16 +7631,12 @@ export interface SubscriptionPhaseInput {
7555
7631
  */
7556
7632
  items: SubscriptionItemInput[];
7557
7633
  }
7558
- /** Addon purchased with a subscription. */
7559
- export interface SubscriptionAddonInput {
7560
- id: string;
7561
- labels?: Labels;
7562
- /** An ISO-8601 timestamp representation of entity creation date. */
7563
- createdAt: Date;
7564
- /** An ISO-8601 timestamp representation of entity last update date. */
7565
- updatedAt: Date;
7566
- /** An ISO-8601 timestamp representation of entity deletion date. */
7567
- 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 {
7568
7640
  /**
7569
7641
  * Display name of the resource.
7570
7642
  *
@@ -7577,23 +7649,18 @@ export interface SubscriptionAddonInput {
7577
7649
  * Maximum 1024 characters.
7578
7650
  */
7579
7651
  description?: string;
7580
- /** The add-on associated with the subscription. */
7581
- addon: AddonReference;
7582
- /** The quantity of the add-on. Always 1 for single instance add-ons. */
7583
- 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;
7584
7659
  /**
7585
- * An ISO-8601 timestamp representation of which point in time the quantity was
7586
- * 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.
7587
7662
  */
7588
- quantityAt: Date;
7589
- /** An ISO-8601 timestamp representation of the cadence start of the resource. */
7590
- activeFrom: Date;
7591
- /** An ISO-8601 timestamp representation of the cadence end of the resource. */
7592
- activeTo?: Date;
7593
- /** The timeline of the add-on. The returned periods are sorted and continuous. */
7594
- timeline: SubscriptionAddonTimelineSegment[];
7595
- /** The rate cards of the add-on. */
7596
- rateCards: SubscriptionAddonRateCardInput[];
7663
+ phases: PlanPhaseInput[];
7597
7664
  }
7598
7665
  /** Plans provide a template for subscriptions. */
7599
7666
  export interface PlanInput {
@@ -7731,6 +7798,46 @@ export interface UpsertPlanRequestInput {
7731
7798
  */
7732
7799
  phases: PlanPhaseInput[];
7733
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
+ }
7734
7841
  /** Page paginated response. */
7735
7842
  export interface AddonPagePaginatedResponseInput {
7736
7843
  data: AddonInput[];
@@ -7827,16 +7934,140 @@ export interface SubscriptionInput {
7827
7934
  */
7828
7935
  phases: SubscriptionPhaseInput[];
7829
7936
  }
7830
- /** Page paginated response. */
7831
- export interface SubscriptionAddonPagePaginatedResponseInput {
7832
- data: SubscriptionAddonInput[];
7833
- meta: PaginatedMeta;
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;
7834
8049
  }
7835
8050
  /** Page paginated response. */
7836
8051
  export interface PlanPagePaginatedResponseInput {
7837
8052
  data: PlanInput[];
7838
8053
  meta: PaginatedMeta;
7839
8054
  }
8055
+ /**
8056
+ * Request for editing a running subscription. Applies an ordered batch of
8057
+ * customizations to the subscription's phases and items. A later customization
8058
+ * observes the state produced by earlier ones.
8059
+ */
8060
+ export interface SubscriptionEditInput {
8061
+ /** The ordered batch of customizations to apply to the running subscription. */
8062
+ customizations: SubscriptionEditOperationInput[];
8063
+ /** When the requested changes should take effect. Defaults to immediate. */
8064
+ timing?: SubscriptionEditTiming;
8065
+ }
8066
+ /** Page paginated response. */
8067
+ export interface SubscriptionAddonPagePaginatedResponseInput {
8068
+ data: SubscriptionAddonInput[];
8069
+ meta: PaginatedMeta;
8070
+ }
7840
8071
  /** A standard invoice for charges owed by the customer. */
7841
8072
  export interface InvoiceStandardInput {
7842
8073
  id: string;
@@ -8193,6 +8424,11 @@ export type RateCardEntitlementInput = RateCardMeteredEntitlementInput | RateCar
8193
8424
  export type ChargeRealizationInvoiceOrReferenceInput = ChargeRealizationInvoiceInput | ChargeRealizationInvoiceReference;
8194
8425
  /** Customer charge. */
8195
8426
  export type CreateChargeRequestInput = CreateChargeFlatFeeRequest | CreateChargeUsageBasedRequestInput;
8427
+ /**
8428
+ * A single customization to apply to a running subscription. The `type` field
8429
+ * discriminates which operation is performed.
8430
+ */
8431
+ export type SubscriptionEditOperationInput = SubscriptionEditAddItemInput | SubscriptionEditRemoveItem | SubscriptionEditAddPhase | SubscriptionEditRemovePhase | SubscriptionEditStretchPhase | SubscriptionEditUnscheduleEdit;
8196
8432
  /**
8197
8433
  * A top-level line item on an invoice.
8198
8434
  *