@openmeter/client 1.0.0-beta-75dd3b9ccc98 → 1.0.0-beta-a175676db126

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
  *
@@ -2271,17 +2231,37 @@ export interface EntitlementAccessQueryError {
2271
2231
  }
2272
2232
  /** App customer data. */
2273
2233
  export interface AppCustomerData {
2274
- /** Used if the customer has a linked Stripe app. */
2275
- stripe?: AppCustomerDataStripe;
2276
- /** Used if the customer has a linked external invoicing app. */
2277
- externalInvoicing?: AppCustomerDataExternalInvoicing;
2234
+ /**
2235
+ * Used if the customer has a linked Stripe app.
2236
+ *
2237
+ * Set to `null` to remove the Stripe data of the customer; omit to leave it
2238
+ * unchanged.
2239
+ */
2240
+ stripe?: AppCustomerDataStripe | null;
2241
+ /**
2242
+ * Used if the customer has a linked external invoicing app.
2243
+ *
2244
+ * Set to `null` to remove the external invoicing data of the customer; omit to
2245
+ * leave it unchanged.
2246
+ */
2247
+ externalInvoicing?: AppCustomerDataExternalInvoicing | null;
2278
2248
  }
2279
2249
  /** AppCustomerData upsert request. */
2280
2250
  export interface UpsertAppCustomerDataRequest {
2281
- /** Used if the customer has a linked Stripe app. */
2282
- stripe?: AppCustomerDataStripe;
2283
- /** Used if the customer has a linked external invoicing app. */
2284
- externalInvoicing?: AppCustomerDataExternalInvoicing;
2251
+ /**
2252
+ * Used if the customer has a linked Stripe app.
2253
+ *
2254
+ * Set to `null` to remove the Stripe data of the customer; omit to leave it
2255
+ * unchanged.
2256
+ */
2257
+ stripe?: AppCustomerDataStripe | null;
2258
+ /**
2259
+ * Used if the customer has a linked external invoicing app.
2260
+ *
2261
+ * Set to `null` to remove the external invoicing data of the customer; omit to
2262
+ * leave it unchanged.
2263
+ */
2264
+ externalInvoicing?: AppCustomerDataExternalInvoicing | null;
2285
2265
  }
2286
2266
  /**
2287
2267
  * A credit adjustment can be used to make manual adjustments to a customer's
@@ -3220,52 +3200,6 @@ export interface SubscriptionCancel {
3220
3200
  /** If not provided the subscription is canceled immediately. */
3221
3201
  timing: SubscriptionEditTiming;
3222
3202
  }
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
3203
  /** SubscriptionAddon create request. */
3270
3204
  export interface CreateSubscriptionAddonRequest {
3271
3205
  labels?: Labels;
@@ -4809,25 +4743,6 @@ export interface SubscriptionItem {
4809
4743
  /** The rate card describing what the customer gets and pays for this item. */
4810
4744
  rateCard: RateCard;
4811
4745
  }
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
4746
  /**
4832
4747
  * The plan phase or pricing ramp allows changing a plan's rate cards over time as
4833
4748
  * a subscription progresses.
@@ -4855,6 +4770,25 @@ export interface PlanPhase {
4855
4770
  /** The rate cards of the plan. */
4856
4771
  rateCards: RateCard[];
4857
4772
  }
4773
+ /**
4774
+ * Add a new rate card to a phase. Adding an item to the current phase closes the
4775
+ * active version of the same item key and appends a new version.
4776
+ */
4777
+ export interface SubscriptionEditAddItem {
4778
+ /** Discriminator for the add-item operation. */
4779
+ type: 'add_item';
4780
+ /** The key of the phase to add the item to. */
4781
+ phaseKey: string;
4782
+ /** The rate card describing what the customer gets and pays for the new item. */
4783
+ rateCard: RateCard;
4784
+ }
4785
+ /** A rate card for a subscription add-on. */
4786
+ export interface SubscriptionAddonRateCard {
4787
+ /** The rate card. */
4788
+ rateCard: RateCard;
4789
+ /** The IDs of the subscription items that this rate card belongs to. */
4790
+ affectedSubscriptionItemIds: string[];
4791
+ }
4858
4792
  /**
4859
4793
  * Add-on allows extending subscriptions with compatible plans with additional
4860
4794
  * ratecards.
@@ -5272,16 +5206,12 @@ export interface SubscriptionPhase {
5272
5206
  */
5273
5207
  items: SubscriptionItem[];
5274
5208
  }
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;
5209
+ /**
5210
+ * An inline (custom) plan definition used to create or change a subscription
5211
+ * without referencing a published plan. Mirrors the plan create shape without a
5212
+ * key or version, since a custom plan is not persisted or versioned on its own.
5213
+ */
5214
+ export interface SubscriptionCustomPlan {
5285
5215
  /**
5286
5216
  * Display name of the resource.
5287
5217
  *
@@ -5294,23 +5224,18 @@ export interface SubscriptionAddon {
5294
5224
  * Maximum 1024 characters.
5295
5225
  */
5296
5226
  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;
5227
+ labels?: Labels;
5228
+ /** The currency code of the plan. */
5229
+ currency: BillingCurrencyCode;
5230
+ /** The billing cadence for subscriptions using this plan. */
5231
+ billingCadence: string;
5232
+ /** Whether pro-rating is enabled for this plan. */
5233
+ proRatingEnabled: boolean;
5301
5234
  /**
5302
- * An ISO-8601 timestamp representation of which point in time the quantity was
5303
- * resolved to.
5235
+ * The plan phases define the pricing ramp for a subscription. A phase switch
5236
+ * occurs only at the end of a billing period. At least one phase is required.
5304
5237
  */
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[];
5238
+ phases: PlanPhase[];
5314
5239
  }
5315
5240
  /** Plans provide a template for subscriptions. */
5316
5241
  export interface Plan {
@@ -5448,6 +5373,46 @@ export interface UpsertPlanRequest {
5448
5373
  */
5449
5374
  phases: PlanPhase[];
5450
5375
  }
5376
+ /** Addon purchased with a subscription. */
5377
+ export interface SubscriptionAddon {
5378
+ id: string;
5379
+ labels?: Labels;
5380
+ /** An ISO-8601 timestamp representation of entity creation date. */
5381
+ createdAt: Date;
5382
+ /** An ISO-8601 timestamp representation of entity last update date. */
5383
+ updatedAt: Date;
5384
+ /** An ISO-8601 timestamp representation of entity deletion date. */
5385
+ deletedAt?: Date;
5386
+ /**
5387
+ * Display name of the resource.
5388
+ *
5389
+ * Between 1 and 256 characters.
5390
+ */
5391
+ name: string;
5392
+ /**
5393
+ * Optional description of the resource.
5394
+ *
5395
+ * Maximum 1024 characters.
5396
+ */
5397
+ description?: string;
5398
+ /** The add-on associated with the subscription. */
5399
+ addon: AddonReference;
5400
+ /** The quantity of the add-on. Always 1 for single instance add-ons. */
5401
+ quantity: number;
5402
+ /**
5403
+ * An ISO-8601 timestamp representation of which point in time the quantity was
5404
+ * resolved to.
5405
+ */
5406
+ quantityAt: Date;
5407
+ /** An ISO-8601 timestamp representation of the cadence start of the resource. */
5408
+ activeFrom: Date;
5409
+ /** An ISO-8601 timestamp representation of the cadence end of the resource. */
5410
+ activeTo?: Date;
5411
+ /** The timeline of the add-on. The returned periods are sorted and continuous. */
5412
+ timeline: SubscriptionAddonTimelineSegment[];
5413
+ /** The rate cards of the add-on. */
5414
+ rateCards: SubscriptionAddonRateCard[];
5415
+ }
5451
5416
  /** Page paginated response. */
5452
5417
  export interface AddonPagePaginatedResponse {
5453
5418
  data: Addon[];
@@ -5544,47 +5509,160 @@ export interface Subscription {
5544
5509
  */
5545
5510
  phases: SubscriptionPhase[];
5546
5511
  }
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;
5512
+ export interface SubscriptionCreate {
5513
+ labels?: Labels;
5571
5514
  /**
5572
- * Optional description of the resource.
5515
+ * Settlement mode for billing.
5573
5516
  *
5574
- * Maximum 1024 characters.
5517
+ * Values:
5518
+ *
5519
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
5520
+ * invoiced.
5521
+ * - `credit_only`: Usage is settled exclusively against credits.
5575
5522
  */
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;
5523
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
5524
+ /** The customer to create the subscription for. */
5525
+ customer: {
5526
+ id?: string;
5527
+ key?: string;
5528
+ };
5529
+ /**
5530
+ * A reference to a published plan the subscription is created from.
5531
+ *
5532
+ * Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the
5533
+ * subscription on an existing published plan; use `custom_plan` to define the plan
5534
+ * inline.
5535
+ */
5536
+ plan?: {
5537
+ id?: string;
5538
+ key?: string;
5539
+ version?: number;
5540
+ };
5541
+ /**
5542
+ * An inline plan definition to create the subscription from, without referencing a
5543
+ * published plan.
5544
+ *
5545
+ * Exactly one of `plan` or `custom_plan` must be provided. The subscription is not
5546
+ * linked to a persisted plan, so the response omits the `plan` reference.
5547
+ */
5548
+ customPlan?: SubscriptionCustomPlan;
5549
+ /**
5550
+ * A billing anchor is the fixed point in time that determines the subscription's
5551
+ * recurring billing cycle. It affects when charges occur and how prorations are
5552
+ * calculated. Common anchors:
5553
+ *
5554
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
5555
+ * - Subscription anniversary (day customer signed up)
5556
+ * - Custom date (customer-specified day)
5557
+ *
5558
+ * If not provided, the subscription will be created with the subscription's
5559
+ * creation time as the billing anchor.
5560
+ */
5561
+ billingAnchor?: Date;
5562
+ /** Controls how custom-currency cost bases are selected for the subscription. */
5563
+ costBasisMode: 'dynamic' | 'pinned';
5564
+ }
5565
+ /** Request for changing a subscription. */
5566
+ export interface SubscriptionChange {
5567
+ labels?: Labels;
5568
+ /**
5569
+ * Settlement mode for billing.
5570
+ *
5571
+ * Values:
5572
+ *
5573
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
5574
+ * invoiced.
5575
+ * - `credit_only`: Usage is settled exclusively against credits.
5576
+ */
5577
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
5578
+ /** The customer to create the subscription for. */
5579
+ customer: {
5580
+ id?: string;
5581
+ key?: string;
5582
+ };
5583
+ /**
5584
+ * A reference to a published plan the subscription is created from.
5585
+ *
5586
+ * Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the
5587
+ * subscription on an existing published plan; use `custom_plan` to define the plan
5588
+ * inline.
5589
+ */
5590
+ plan?: {
5591
+ id?: string;
5592
+ key?: string;
5593
+ version?: number;
5594
+ };
5595
+ /**
5596
+ * An inline plan definition to create the subscription from, without referencing a
5597
+ * published plan.
5598
+ *
5599
+ * Exactly one of `plan` or `custom_plan` must be provided. The subscription is not
5600
+ * linked to a persisted plan, so the response omits the `plan` reference.
5601
+ */
5602
+ customPlan?: SubscriptionCustomPlan;
5603
+ /**
5604
+ * A billing anchor is the fixed point in time that determines the subscription's
5605
+ * recurring billing cycle. It affects when charges occur and how prorations are
5606
+ * calculated. Common anchors:
5607
+ *
5608
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
5609
+ * - Subscription anniversary (day customer signed up)
5610
+ * - Custom date (customer-specified day)
5611
+ *
5612
+ * If not provided, the subscription will be created with the subscription's
5613
+ * creation time as the billing anchor.
5614
+ */
5615
+ billingAnchor?: Date;
5616
+ /** Controls how custom-currency cost bases are selected for the subscription. */
5617
+ costBasisMode: 'dynamic' | 'pinned';
5618
+ /**
5619
+ * Timing configuration for the change, when the change should take effect. For
5620
+ * changing a subscription, the accepted values depend on the subscription
5621
+ * configuration.
5622
+ */
5623
+ timing: SubscriptionEditTiming;
5624
+ }
5625
+ /** Page paginated response. */
5626
+ export interface PlanPagePaginatedResponse {
5627
+ data: Plan[];
5628
+ meta: PaginatedMeta;
5629
+ }
5630
+ /**
5631
+ * Request for editing a running subscription. Applies an ordered batch of
5632
+ * customizations to the subscription's phases and items. A later customization
5633
+ * observes the state produced by earlier ones.
5634
+ */
5635
+ export interface SubscriptionEdit {
5636
+ /** The ordered batch of customizations to apply to the running subscription. */
5637
+ customizations: SubscriptionEditOperation[];
5638
+ /** When the requested changes should take effect. Defaults to immediate. */
5639
+ timing: SubscriptionEditTiming;
5640
+ }
5641
+ /** Page paginated response. */
5642
+ export interface SubscriptionAddonPagePaginatedResponse {
5643
+ data: SubscriptionAddon[];
5644
+ meta: PaginatedMeta;
5645
+ }
5646
+ /** A standard invoice for charges owed by the customer. */
5647
+ export interface InvoiceStandard {
5648
+ id: string;
5649
+ /**
5650
+ * Optional description of the resource.
5651
+ *
5652
+ * Maximum 1024 characters.
5653
+ */
5654
+ description?: string;
5655
+ labels?: Labels;
5656
+ /** An ISO-8601 timestamp representation of entity creation date. */
5657
+ createdAt: Date;
5658
+ /** An ISO-8601 timestamp representation of entity last update date. */
5659
+ updatedAt: Date;
5660
+ /** An ISO-8601 timestamp representation of entity deletion date. */
5661
+ deletedAt?: Date;
5662
+ /** Human-readable invoice number generated by the invoicing app. */
5663
+ number: string;
5664
+ /** Three-letter ISO 4217 currency code for the invoice. */
5665
+ currency: string;
5588
5666
  /**
5589
5667
  * Snapshot of the supplier's contact information at the time the invoice was
5590
5668
  * issued.
@@ -6341,46 +6419,6 @@ export interface VoidCreditGrantRequestInput {
6341
6419
  */
6342
6420
  paymentAdjustment?: 'none';
6343
6421
  }
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
6422
  /**
6385
6423
  * Unit conversion configuration.
6386
6424
  *
@@ -6493,52 +6531,6 @@ export interface SubscriptionCancelInput {
6493
6531
  /** If not provided the subscription is canceled immediately. */
6494
6532
  timing?: SubscriptionEditTiming;
6495
6533
  }
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
6534
  /**
6543
6535
  * Invoice-level snapshot of the workflow configuration.
6544
6536
  *
@@ -7238,25 +7230,6 @@ export interface SubscriptionItemInput {
7238
7230
  /** The rate card describing what the customer gets and pays for this item. */
7239
7231
  rateCard: RateCardInput;
7240
7232
  }
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
7233
  /**
7261
7234
  * The plan phase or pricing ramp allows changing a plan's rate cards over time as
7262
7235
  * a subscription progresses.
@@ -7284,6 +7257,25 @@ export interface PlanPhaseInput {
7284
7257
  /** The rate cards of the plan. */
7285
7258
  rateCards: RateCardInput[];
7286
7259
  }
7260
+ /**
7261
+ * Add a new rate card to a phase. Adding an item to the current phase closes the
7262
+ * active version of the same item key and appends a new version.
7263
+ */
7264
+ export interface SubscriptionEditAddItemInput {
7265
+ /** Discriminator for the add-item operation. */
7266
+ type: 'add_item';
7267
+ /** The key of the phase to add the item to. */
7268
+ phaseKey: string;
7269
+ /** The rate card describing what the customer gets and pays for the new item. */
7270
+ rateCard: RateCardInput;
7271
+ }
7272
+ /** A rate card for a subscription add-on. */
7273
+ export interface SubscriptionAddonRateCardInput {
7274
+ /** The rate card. */
7275
+ rateCard: RateCardInput;
7276
+ /** The IDs of the subscription items that this rate card belongs to. */
7277
+ affectedSubscriptionItemIds: string[];
7278
+ }
7287
7279
  /**
7288
7280
  * Add-on allows extending subscriptions with compatible plans with additional
7289
7281
  * ratecards.
@@ -7659,16 +7651,12 @@ export interface SubscriptionPhaseInput {
7659
7651
  */
7660
7652
  items: SubscriptionItemInput[];
7661
7653
  }
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;
7654
+ /**
7655
+ * An inline (custom) plan definition used to create or change a subscription
7656
+ * without referencing a published plan. Mirrors the plan create shape without a
7657
+ * key or version, since a custom plan is not persisted or versioned on its own.
7658
+ */
7659
+ export interface SubscriptionCustomPlanInput {
7672
7660
  /**
7673
7661
  * Display name of the resource.
7674
7662
  *
@@ -7681,23 +7669,18 @@ export interface SubscriptionAddonInput {
7681
7669
  * Maximum 1024 characters.
7682
7670
  */
7683
7671
  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;
7672
+ labels?: Labels;
7673
+ /** The currency code of the plan. */
7674
+ currency: BillingCurrencyCode;
7675
+ /** The billing cadence for subscriptions using this plan. */
7676
+ billingCadence: string;
7677
+ /** Whether pro-rating is enabled for this plan. */
7678
+ proRatingEnabled?: boolean;
7688
7679
  /**
7689
- * An ISO-8601 timestamp representation of which point in time the quantity was
7690
- * resolved to.
7680
+ * The plan phases define the pricing ramp for a subscription. A phase switch
7681
+ * occurs only at the end of a billing period. At least one phase is required.
7691
7682
  */
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[];
7683
+ phases: PlanPhaseInput[];
7701
7684
  }
7702
7685
  /** Plans provide a template for subscriptions. */
7703
7686
  export interface PlanInput {
@@ -7835,6 +7818,46 @@ export interface UpsertPlanRequestInput {
7835
7818
  */
7836
7819
  phases: PlanPhaseInput[];
7837
7820
  }
7821
+ /** Addon purchased with a subscription. */
7822
+ export interface SubscriptionAddonInput {
7823
+ id: string;
7824
+ labels?: Labels;
7825
+ /** An ISO-8601 timestamp representation of entity creation date. */
7826
+ createdAt: Date;
7827
+ /** An ISO-8601 timestamp representation of entity last update date. */
7828
+ updatedAt: Date;
7829
+ /** An ISO-8601 timestamp representation of entity deletion date. */
7830
+ deletedAt?: Date;
7831
+ /**
7832
+ * Display name of the resource.
7833
+ *
7834
+ * Between 1 and 256 characters.
7835
+ */
7836
+ name: string;
7837
+ /**
7838
+ * Optional description of the resource.
7839
+ *
7840
+ * Maximum 1024 characters.
7841
+ */
7842
+ description?: string;
7843
+ /** The add-on associated with the subscription. */
7844
+ addon: AddonReference;
7845
+ /** The quantity of the add-on. Always 1 for single instance add-ons. */
7846
+ quantity: number;
7847
+ /**
7848
+ * An ISO-8601 timestamp representation of which point in time the quantity was
7849
+ * resolved to.
7850
+ */
7851
+ quantityAt: Date;
7852
+ /** An ISO-8601 timestamp representation of the cadence start of the resource. */
7853
+ activeFrom: Date;
7854
+ /** An ISO-8601 timestamp representation of the cadence end of the resource. */
7855
+ activeTo?: Date;
7856
+ /** The timeline of the add-on. The returned periods are sorted and continuous. */
7857
+ timeline: SubscriptionAddonTimelineSegment[];
7858
+ /** The rate cards of the add-on. */
7859
+ rateCards: SubscriptionAddonRateCardInput[];
7860
+ }
7838
7861
  /** Page paginated response. */
7839
7862
  export interface AddonPagePaginatedResponseInput {
7840
7863
  data: AddonInput[];
@@ -7931,6 +7954,124 @@ export interface SubscriptionInput {
7931
7954
  */
7932
7955
  phases: SubscriptionPhaseInput[];
7933
7956
  }
7957
+ export interface SubscriptionCreateInput {
7958
+ labels?: Labels;
7959
+ /**
7960
+ * Settlement mode for billing.
7961
+ *
7962
+ * Values:
7963
+ *
7964
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
7965
+ * invoiced.
7966
+ * - `credit_only`: Usage is settled exclusively against credits.
7967
+ */
7968
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
7969
+ /** The customer to create the subscription for. */
7970
+ customer: {
7971
+ id?: string;
7972
+ key?: string;
7973
+ };
7974
+ /**
7975
+ * A reference to a published plan the subscription is created from.
7976
+ *
7977
+ * Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the
7978
+ * subscription on an existing published plan; use `custom_plan` to define the plan
7979
+ * inline.
7980
+ */
7981
+ plan?: {
7982
+ id?: string;
7983
+ key?: string;
7984
+ version?: number;
7985
+ };
7986
+ /**
7987
+ * An inline plan definition to create the subscription from, without referencing a
7988
+ * published plan.
7989
+ *
7990
+ * Exactly one of `plan` or `custom_plan` must be provided. The subscription is not
7991
+ * linked to a persisted plan, so the response omits the `plan` reference.
7992
+ */
7993
+ customPlan?: SubscriptionCustomPlanInput;
7994
+ /**
7995
+ * A billing anchor is the fixed point in time that determines the subscription's
7996
+ * recurring billing cycle. It affects when charges occur and how prorations are
7997
+ * calculated. Common anchors:
7998
+ *
7999
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
8000
+ * - Subscription anniversary (day customer signed up)
8001
+ * - Custom date (customer-specified day)
8002
+ *
8003
+ * If not provided, the subscription will be created with the subscription's
8004
+ * creation time as the billing anchor.
8005
+ */
8006
+ billingAnchor?: Date;
8007
+ /** Controls how custom-currency cost bases are selected for the subscription. */
8008
+ costBasisMode?: 'dynamic' | 'pinned';
8009
+ }
8010
+ /** Request for changing a subscription. */
8011
+ export interface SubscriptionChangeInput {
8012
+ labels?: Labels;
8013
+ /**
8014
+ * Settlement mode for billing.
8015
+ *
8016
+ * Values:
8017
+ *
8018
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
8019
+ * invoiced.
8020
+ * - `credit_only`: Usage is settled exclusively against credits.
8021
+ */
8022
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
8023
+ /** The customer to create the subscription for. */
8024
+ customer: {
8025
+ id?: string;
8026
+ key?: string;
8027
+ };
8028
+ /**
8029
+ * A reference to a published plan the subscription is created from.
8030
+ *
8031
+ * Exactly one of `plan` or `custom_plan` must be provided. Use `plan` to base the
8032
+ * subscription on an existing published plan; use `custom_plan` to define the plan
8033
+ * inline.
8034
+ */
8035
+ plan?: {
8036
+ id?: string;
8037
+ key?: string;
8038
+ version?: number;
8039
+ };
8040
+ /**
8041
+ * An inline plan definition to create the subscription from, without referencing a
8042
+ * published plan.
8043
+ *
8044
+ * Exactly one of `plan` or `custom_plan` must be provided. The subscription is not
8045
+ * linked to a persisted plan, so the response omits the `plan` reference.
8046
+ */
8047
+ customPlan?: SubscriptionCustomPlanInput;
8048
+ /**
8049
+ * A billing anchor is the fixed point in time that determines the subscription's
8050
+ * recurring billing cycle. It affects when charges occur and how prorations are
8051
+ * calculated. Common anchors:
8052
+ *
8053
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
8054
+ * - Subscription anniversary (day customer signed up)
8055
+ * - Custom date (customer-specified day)
8056
+ *
8057
+ * If not provided, the subscription will be created with the subscription's
8058
+ * creation time as the billing anchor.
8059
+ */
8060
+ billingAnchor?: Date;
8061
+ /** Controls how custom-currency cost bases are selected for the subscription. */
8062
+ costBasisMode?: 'dynamic' | 'pinned';
8063
+ /**
8064
+ * Timing configuration for the change, when the change should take effect. For
8065
+ * changing a subscription, the accepted values depend on the subscription
8066
+ * configuration.
8067
+ */
8068
+ timing: SubscriptionEditTiming;
8069
+ }
8070
+ /** Page paginated response. */
8071
+ export interface PlanPagePaginatedResponseInput {
8072
+ data: PlanInput[];
8073
+ meta: PaginatedMeta;
8074
+ }
7934
8075
  /**
7935
8076
  * Request for editing a running subscription. Applies an ordered batch of
7936
8077
  * customizations to the subscription's phases and items. A later customization
@@ -7947,11 +8088,6 @@ export interface SubscriptionAddonPagePaginatedResponseInput {
7947
8088
  data: SubscriptionAddonInput[];
7948
8089
  meta: PaginatedMeta;
7949
8090
  }
7950
- /** Page paginated response. */
7951
- export interface PlanPagePaginatedResponseInput {
7952
- data: PlanInput[];
7953
- meta: PaginatedMeta;
7954
- }
7955
8091
  /** A standard invoice for charges owed by the customer. */
7956
8092
  export interface InvoiceStandardInput {
7957
8093
  id: string;