@openmeter/client 1.0.0-beta-1e01089e8f75 → 1.0.0-beta-19a1f6bdbcd5

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.
@@ -587,18 +587,6 @@ export interface PriceFlat {
587
587
  /** The amount of the flat price. */
588
588
  amount: string;
589
589
  }
590
- /**
591
- * Unit price.
592
- *
593
- * Charges a fixed rate per billing unit. When UnitConfig is present on the rate
594
- * card, billing units are the converted quantities (e.g. GB instead of bytes).
595
- */
596
- export interface PriceUnit {
597
- /** The type of the price. */
598
- type: 'unit';
599
- /** The amount of the unit price. */
600
- amount: string;
601
- }
602
590
  /** Discount configuration for a rate card. */
603
591
  export interface RateCardDiscounts {
604
592
  /** Percentage discount applied to the price (0–100). */
@@ -630,8 +618,20 @@ export interface Totals {
630
618
  total: string;
631
619
  }
632
620
  /**
633
- * Spend commitments for a rate card. The customer is committed to spend at least
634
- * the minimum amount and at most the maximum amount.
621
+ * Unit price.
622
+ *
623
+ * Charges a fixed rate per billing unit. When UnitConfig is present on the object,
624
+ * billing units are the converted quantities (e.g. GB instead of bytes).
625
+ */
626
+ export interface PriceUnit {
627
+ /** The type of the price. */
628
+ type: 'unit';
629
+ /** The amount of the unit price. */
630
+ amount: string;
631
+ }
632
+ /**
633
+ * Spend commitments for a usage-based price. The customer is committed to spend at
634
+ * least the minimum amount and at most the maximum amount.
635
635
  */
636
636
  export interface SpendCommitments {
637
637
  /** The customer is committed to spend at least the amount. */
@@ -672,8 +672,8 @@ export interface UpdatePriceFlat {
672
672
  /**
673
673
  * Unit price.
674
674
  *
675
- * Charges a fixed rate per billing unit. When UnitConfig is present on the rate
676
- * card, billing units are the converted quantities (e.g. GB instead of bytes).
675
+ * Charges a fixed rate per billing unit. When UnitConfig is present on the object,
676
+ * billing units are the converted quantities (e.g. GB instead of bytes).
677
677
  */
678
678
  export interface UpdatePriceUnit {
679
679
  /** The type of the price. */
@@ -1778,52 +1778,12 @@ export interface SubscriptionProRatingConfig {
1778
1778
  /** How pro-rating is calculated when enabled. */
1779
1779
  mode: 'no_proration' | 'prorate_prices';
1780
1780
  }
1781
- /** Subscription create request. */
1782
- export interface SubscriptionCreate {
1783
- labels?: Labels;
1784
- /**
1785
- * Settlement mode for billing.
1786
- *
1787
- * Values:
1788
- *
1789
- * - `credit_then_invoice`: Credits are applied first, then any remainder is
1790
- * invoiced.
1791
- * - `credit_only`: Usage is settled exclusively against credits.
1792
- */
1793
- settlementMode?: 'credit_then_invoice' | 'credit_only';
1794
- /** The customer to create the subscription for. */
1795
- customer: {
1796
- id?: string;
1797
- key?: string;
1798
- };
1799
- /** The plan reference of the subscription. */
1800
- plan: {
1801
- id?: string;
1802
- key?: string;
1803
- version?: number;
1804
- };
1805
- /**
1806
- * A billing anchor is the fixed point in time that determines the subscription's
1807
- * recurring billing cycle. It affects when charges occur and how prorations are
1808
- * calculated. Common anchors:
1809
- *
1810
- * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
1811
- * - Subscription anniversary (day customer signed up)
1812
- * - Custom date (customer-specified day)
1813
- *
1814
- * If not provided, the subscription will be created with the subscription's
1815
- * creation time as the billing anchor.
1816
- */
1817
- billingAnchor?: Date;
1818
- /** Controls how custom-currency cost bases are selected for the subscription. */
1819
- costBasisMode: 'dynamic' | 'pinned';
1820
- }
1821
1781
  /**
1822
1782
  * Unit conversion configuration.
1823
1783
  *
1824
1784
  * Transforms raw metered quantities into billing-ready units before pricing and
1825
- * entitlement evaluation. Applied at the rate card level so the same feature can
1826
- * be billed in different units across plans.
1785
+ * entitlement evaluation. Stored with a resource's rating configuration so the
1786
+ * same metered feature can be billed in different units across plans and charges.
1827
1787
  *
1828
1788
  * Examples:
1829
1789
  *
@@ -1876,6 +1836,46 @@ export interface UnitConfig {
1876
1836
  */
1877
1837
  displayUnit?: string;
1878
1838
  }
1839
+ /** Subscription create request. */
1840
+ export interface SubscriptionCreate {
1841
+ labels?: Labels;
1842
+ /**
1843
+ * Settlement mode for billing.
1844
+ *
1845
+ * Values:
1846
+ *
1847
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
1848
+ * invoiced.
1849
+ * - `credit_only`: Usage is settled exclusively against credits.
1850
+ */
1851
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
1852
+ /** The customer to create the subscription for. */
1853
+ customer: {
1854
+ id?: string;
1855
+ key?: string;
1856
+ };
1857
+ /** The plan reference of the subscription. */
1858
+ plan: {
1859
+ id?: string;
1860
+ key?: string;
1861
+ version?: number;
1862
+ };
1863
+ /**
1864
+ * A billing anchor is the fixed point in time that determines the subscription's
1865
+ * recurring billing cycle. It affects when charges occur and how prorations are
1866
+ * calculated. Common anchors:
1867
+ *
1868
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
1869
+ * - Subscription anniversary (day customer signed up)
1870
+ * - Custom date (customer-specified day)
1871
+ *
1872
+ * If not provided, the subscription will be created with the subscription's
1873
+ * creation time as the billing anchor.
1874
+ */
1875
+ billingAnchor?: Date;
1876
+ /** Controls how custom-currency cost bases are selected for the subscription. */
1877
+ costBasisMode: 'dynamic' | 'pinned';
1878
+ }
1879
1879
  /** Mapping of app types to tax codes. */
1880
1880
  export interface TaxCodeAppMapping {
1881
1881
  /** The app type that the tax code is associated with. */
@@ -2244,12 +2244,27 @@ export interface CreditTransaction {
2244
2244
  after: string;
2245
2245
  };
2246
2246
  }
2247
+ /**
2248
+ * The totals of a charge.
2249
+ *
2250
+ * RealTime is only expanded when the `real_time_usage` expand is used.
2251
+ */
2252
+ export interface ChargeTotals {
2253
+ /** The amount of the charge already booked to the internal accounting system. */
2254
+ booked: Totals;
2255
+ /**
2256
+ * The realtime amount of the charge.
2257
+ *
2258
+ * Requires the `realtime_usage` expand.
2259
+ */
2260
+ realtime?: Totals;
2261
+ }
2247
2262
  /**
2248
2263
  * A price tier used in graduated and volume pricing.
2249
2264
  *
2250
2265
  * At least one price component (flat_price or unit_price) must be set. When
2251
- * UnitConfig is present on the rate card, up_to_amount is expressed in converted
2252
- * billing units.
2266
+ * UnitConfig is present on the containing resource, up_to_amount is expressed in
2267
+ * converted billing units.
2253
2268
  */
2254
2269
  export interface PriceTier {
2255
2270
  /**
@@ -2262,27 +2277,12 @@ export interface PriceTier {
2262
2277
  /** The unit price component of the tier. Charged per billing unit within the tier. */
2263
2278
  unitPrice?: PriceUnit;
2264
2279
  }
2265
- /**
2266
- * The totals of a change.
2267
- *
2268
- * RealTime is only expanded when the `real_time_usage` expand is used.
2269
- */
2270
- export interface ChargeTotals {
2271
- /** The amount of the charge already booked to the internal accounting system. */
2272
- booked: Totals;
2273
- /**
2274
- * The realtime amount of the charge.
2275
- *
2276
- * Requires the `realtime_usage` expand.
2277
- */
2278
- realtime?: Totals;
2279
- }
2280
2280
  /**
2281
2281
  * A price tier used in graduated and volume pricing.
2282
2282
  *
2283
2283
  * At least one price component (flat_price or unit_price) must be set. When
2284
- * UnitConfig is present on the rate card, up_to_amount is expressed in converted
2285
- * billing units.
2284
+ * UnitConfig is present on the containing resource, up_to_amount is expressed in
2285
+ * converted billing units.
2286
2286
  */
2287
2287
  export interface UpdatePriceTier {
2288
2288
  /**
@@ -3211,8 +3211,8 @@ export interface CreditTransactionPaginatedResponse {
3211
3211
  * Each tier's rate applies only to the usage within that tier. Pricing can change
3212
3212
  * as cumulative usage crosses tier boundaries.
3213
3213
  *
3214
- * When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are
3215
- * expressed in converted billing units.
3214
+ * When UnitConfig is present on the containing resource, tier boundaries
3215
+ * (up_to_amount) are expressed in converted billing units.
3216
3216
  */
3217
3217
  export interface PriceGraduated {
3218
3218
  /** The type of the price. */
@@ -3226,8 +3226,8 @@ export interface PriceGraduated {
3226
3226
  * The maximum quantity within a period determines the per-unit price for all units
3227
3227
  * in that period.
3228
3228
  *
3229
- * When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are
3230
- * expressed in converted billing units.
3229
+ * When UnitConfig is present on the containing resource, tier boundaries
3230
+ * (up_to_amount) are expressed in converted billing units.
3231
3231
  */
3232
3232
  export interface PriceVolume {
3233
3233
  /** The type of the price. */
@@ -3241,8 +3241,8 @@ export interface PriceVolume {
3241
3241
  * Each tier's rate applies only to the usage within that tier. Pricing can change
3242
3242
  * as cumulative usage crosses tier boundaries.
3243
3243
  *
3244
- * When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are
3245
- * expressed in converted billing units.
3244
+ * When UnitConfig is present on the containing resource, tier boundaries
3245
+ * (up_to_amount) are expressed in converted billing units.
3246
3246
  */
3247
3247
  export interface UpdatePriceGraduated {
3248
3248
  /** The type of the price. */
@@ -3256,8 +3256,8 @@ export interface UpdatePriceGraduated {
3256
3256
  * The maximum quantity within a period determines the per-unit price for all units
3257
3257
  * in that period.
3258
3258
  *
3259
- * When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are
3260
- * expressed in converted billing units.
3259
+ * When UnitConfig is present on the containing resource, tier boundaries
3260
+ * (up_to_amount) are expressed in converted billing units.
3261
3261
  */
3262
3262
  export interface UpdatePriceVolume {
3263
3263
  /** The type of the price. */
@@ -3656,6 +3656,86 @@ export interface AppStripeCreateCheckoutSessionRequestOptions {
3656
3656
  /** Configuration for collecting tax IDs during checkout. */
3657
3657
  taxIdCollection?: AppStripeCreateCheckoutSessionTaxIdCollection;
3658
3658
  }
3659
+ /** A flat fee charge for a customer. */
3660
+ export interface ChargeFlatFee {
3661
+ id: string;
3662
+ /**
3663
+ * Display name of the resource.
3664
+ *
3665
+ * Between 1 and 256 characters.
3666
+ */
3667
+ name: string;
3668
+ /**
3669
+ * Optional description of the resource.
3670
+ *
3671
+ * Maximum 1024 characters.
3672
+ */
3673
+ description?: string;
3674
+ labels?: Labels;
3675
+ /** An ISO-8601 timestamp representation of entity creation date. */
3676
+ createdAt: Date;
3677
+ /** An ISO-8601 timestamp representation of entity last update date. */
3678
+ updatedAt: Date;
3679
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3680
+ deletedAt?: Date;
3681
+ /** The type of the charge. */
3682
+ type: 'flat_fee';
3683
+ /** The customer owning the charge. */
3684
+ customer: BillingCustomerReference;
3685
+ /**
3686
+ * Indicates whether the charge lifecycle is controlled by OpenMeter or manually
3687
+ * overridden by the API user.
3688
+ */
3689
+ lifecycleController: 'system' | 'manual';
3690
+ /**
3691
+ * The subscription that originated the charge, when the charge was created from a
3692
+ * subscription item.
3693
+ */
3694
+ subscription?: SubscriptionReference;
3695
+ /** The currency of the charge. */
3696
+ currency: string;
3697
+ /** The lifecycle status of the charge. */
3698
+ status: 'created' | 'active' | 'final' | 'deleted';
3699
+ /** The timestamp when the charge is intended to be invoiced. */
3700
+ invoiceAt: Date;
3701
+ /** The effective service period covered by the charge. */
3702
+ servicePeriod: ClosedPeriod;
3703
+ /** The full, unprorated service period of the charge. */
3704
+ fullServicePeriod: ClosedPeriod;
3705
+ /** The billing period the charge belongs to. */
3706
+ billingPeriod: ClosedPeriod;
3707
+ /**
3708
+ * The earliest time when the charge should be advanced again by background
3709
+ * processing.
3710
+ */
3711
+ advanceAfter?: Date;
3712
+ /** Unique reference ID of the charge. */
3713
+ uniqueReferenceId?: string;
3714
+ /** Settlement mode of the charge. */
3715
+ settlementMode: 'credit_then_invoice' | 'credit_only';
3716
+ /** Tax configuration of the charge. */
3717
+ taxConfig?: TaxConfig;
3718
+ /** Payment term of the flat fee charge. */
3719
+ paymentTerm: PricePaymentTerm;
3720
+ /** The discounts applied to the charge. */
3721
+ discounts?: ChargeFlatFeeDiscounts;
3722
+ /** The feature associated with the charge, when applicable. */
3723
+ featureKey?: string;
3724
+ /** The feature ID associated with the charge. */
3725
+ featureId?: string;
3726
+ /** The proration configuration of the charge. */
3727
+ prorationConfiguration: RateCardProrationConfiguration;
3728
+ /** The amount after proration of the charge. */
3729
+ amountAfterProration: CurrencyAmount;
3730
+ /** The price of the charge. */
3731
+ price: PriceFlat;
3732
+ /**
3733
+ * Current intent from the system lifecycle controller for a charge that has an
3734
+ * active manual override. The top-level charge fields remain the effective
3735
+ * customer-facing intent.
3736
+ */
3737
+ systemIntent?: ChargeFlatFeeSystemIntent;
3738
+ }
3659
3739
  /** Page paginated response. */
3660
3740
  export interface TaxCodePagePaginatedResponse {
3661
3741
  data: TaxCode[];
@@ -4208,9 +4288,11 @@ export interface EntitlementAccessQueryResponse {
4208
4288
  */
4209
4289
  meta: CursorMeta;
4210
4290
  }
4211
- /** A flat fee charge for a customer. */
4212
- export interface ChargeFlatFee {
4213
- id: string;
4291
+ /**
4292
+ * Usage-based intent fields from the system lifecycle controller shadowed by a
4293
+ * manual override.
4294
+ */
4295
+ export interface ChargeUsageBasedSystemIntent {
4214
4296
  /**
4215
4297
  * Display name of the resource.
4216
4298
  *
@@ -4224,30 +4306,6 @@ export interface ChargeFlatFee {
4224
4306
  */
4225
4307
  description?: string;
4226
4308
  labels?: Labels;
4227
- /** An ISO-8601 timestamp representation of entity creation date. */
4228
- createdAt: Date;
4229
- /** An ISO-8601 timestamp representation of entity last update date. */
4230
- updatedAt: Date;
4231
- /** An ISO-8601 timestamp representation of entity deletion date. */
4232
- deletedAt?: Date;
4233
- /** The type of the charge. */
4234
- type: 'flat_fee';
4235
- /** The customer owning the charge. */
4236
- customer: BillingCustomerReference;
4237
- /**
4238
- * Indicates whether the charge lifecycle is controlled by OpenMeter or manually
4239
- * overridden by the API user.
4240
- */
4241
- lifecycleController: 'system' | 'manual';
4242
- /**
4243
- * The subscription that originated the charge, when the charge was created from a
4244
- * subscription item.
4245
- */
4246
- subscription?: SubscriptionReference;
4247
- /** The currency of the charge. */
4248
- currency: string;
4249
- /** The lifecycle status of the charge. */
4250
- status: 'created' | 'active' | 'final' | 'deleted';
4251
4309
  /** The timestamp when the charge is intended to be invoiced. */
4252
4310
  invoiceAt: Date;
4253
4311
  /** The effective service period covered by the charge. */
@@ -4256,68 +4314,23 @@ export interface ChargeFlatFee {
4256
4314
  fullServicePeriod: ClosedPeriod;
4257
4315
  /** The billing period the charge belongs to. */
4258
4316
  billingPeriod: ClosedPeriod;
4317
+ /** Discounts applied to the usage-based charge. */
4318
+ discounts?: RateCardDiscounts;
4319
+ /** The price of the charge. */
4320
+ price: PriceUsageBased;
4321
+ /** Spend commitments for the charge. */
4322
+ commitments?: SpendCommitments;
4259
4323
  /**
4260
- * The earliest time when the charge should be advanced again by background
4261
- * processing.
4324
+ * Unit conversion configuration for the charge.
4325
+ *
4326
+ * Synthesized on read for charges created from v1 dynamic or package prices:
4327
+ * dynamic prices map to a unit price with a multiply unit config, and package
4328
+ * prices map to a unit price with a divide unit config.
4329
+ *
4330
+ * Accepted on create only when the UnitConfig feature is enabled on the
4331
+ * deployment; otherwise rejected.
4262
4332
  */
4263
- advanceAfter?: Date;
4264
- /** Unique reference ID of the charge. */
4265
- uniqueReferenceId?: string;
4266
- /** Settlement mode of the charge. */
4267
- settlementMode: 'credit_then_invoice' | 'credit_only';
4268
- /** Tax configuration of the charge. */
4269
- taxConfig?: TaxConfig;
4270
- /** Payment term of the flat fee charge. */
4271
- paymentTerm: PricePaymentTerm;
4272
- /** The discounts applied to the charge. */
4273
- discounts?: ChargeFlatFeeDiscounts;
4274
- /** The feature associated with the charge, when applicable. */
4275
- featureKey?: string;
4276
- /** The feature ID associated with the charge. */
4277
- featureId?: string;
4278
- /** The proration configuration of the charge. */
4279
- prorationConfiguration: RateCardProrationConfiguration;
4280
- /** The amount after proration of the charge. */
4281
- amountAfterProration: CurrencyAmount;
4282
- /** The price of the charge. */
4283
- price: Price;
4284
- /**
4285
- * Current intent from the system lifecycle controller for a charge that has an
4286
- * active manual override. The top-level charge fields remain the effective
4287
- * customer-facing intent.
4288
- */
4289
- systemIntent?: ChargeFlatFeeSystemIntent;
4290
- }
4291
- /**
4292
- * Usage-based intent fields from the system lifecycle controller shadowed by a
4293
- * manual override.
4294
- */
4295
- export interface ChargeUsageBasedSystemIntent {
4296
- /**
4297
- * Display name of the resource.
4298
- *
4299
- * Between 1 and 256 characters.
4300
- */
4301
- name: string;
4302
- /**
4303
- * Optional description of the resource.
4304
- *
4305
- * Maximum 1024 characters.
4306
- */
4307
- description?: string;
4308
- labels?: Labels;
4309
- /** The timestamp when the charge is intended to be invoiced. */
4310
- invoiceAt: Date;
4311
- /** The effective service period covered by the charge. */
4312
- servicePeriod: ClosedPeriod;
4313
- /** The full, unprorated service period of the charge. */
4314
- fullServicePeriod: ClosedPeriod;
4315
- /** The billing period the charge belongs to. */
4316
- billingPeriod: ClosedPeriod;
4317
- /** Discounts applied to the usage-based charge. */
4318
- discounts?: RateCardDiscounts;
4319
- /** The price of the charge. */
4320
- price: Price;
4333
+ unitConfig?: UnitConfig;
4321
4334
  /**
4322
4335
  * The timestamp when the system lifecycle controller intent was deleted. The
4323
4336
  * effective charge can remain visible while a manual override is active.
@@ -4358,7 +4371,20 @@ export interface CreateChargeUsageBasedRequest {
4358
4371
  /** The feature ID associated with the charge. */
4359
4372
  featureId: string;
4360
4373
  /** The price of the charge. */
4361
- price: Price;
4374
+ price: PriceUsageBased;
4375
+ /** Spend commitments for the charge. */
4376
+ commitments?: SpendCommitments;
4377
+ /**
4378
+ * Unit conversion configuration for the charge.
4379
+ *
4380
+ * Synthesized on read for charges created from v1 dynamic or package prices:
4381
+ * dynamic prices map to a unit price with a multiply unit config, and package
4382
+ * prices map to a unit price with a divide unit config.
4383
+ *
4384
+ * Accepted on create only when the UnitConfig feature is enabled on the
4385
+ * deployment; otherwise rejected.
4386
+ */
4387
+ unitConfig?: UnitConfig;
4362
4388
  /** The full, unprorated service period of the charge. */
4363
4389
  fullServicePeriod?: ClosedPeriod;
4364
4390
  /** The billing period the charge belongs to. */
@@ -4550,7 +4576,20 @@ export interface ChargeUsageBased {
4550
4576
  /** Aggregated booked and realtime totals for the charge. */
4551
4577
  totals: ChargeTotals;
4552
4578
  /** The price of the charge. */
4553
- price: Price;
4579
+ price: PriceUsageBased;
4580
+ /** Spend commitments for the charge. */
4581
+ commitments?: SpendCommitments;
4582
+ /**
4583
+ * Unit conversion configuration for the charge.
4584
+ *
4585
+ * Synthesized on read for charges created from v1 dynamic or package prices:
4586
+ * dynamic prices map to a unit price with a multiply unit config, and package
4587
+ * prices map to a unit price with a divide unit config.
4588
+ *
4589
+ * Accepted on create only when the UnitConfig feature is enabled on the
4590
+ * deployment; otherwise rejected.
4591
+ */
4592
+ unitConfig?: UnitConfig;
4554
4593
  /**
4555
4594
  * Current intent from the system lifecycle controller for a charge that has an
4556
4595
  * active manual override. The top-level charge fields remain the effective
@@ -5473,6 +5512,13 @@ export type Currency = CurrencyFiat | CurrencyCustom;
5473
5512
  * arrears items).
5474
5513
  */
5475
5514
  export type WorkflowCollectionAlignment = WorkflowCollectionAlignmentSubscription | WorkflowCollectionAlignmentAnchored;
5515
+ /**
5516
+ * Usage-based price types for a rate card or charge.
5517
+ *
5518
+ * When UnitConfig is present on the object, these price types operate on billing
5519
+ * units (i.e. post-conversion quantities), not raw metered units.
5520
+ */
5521
+ export type PriceUsageBased = PriceUnit | PriceGraduated | PriceVolume;
5476
5522
  /** Price. */
5477
5523
  export type Price = PriceFree | PriceFlat | PriceUnit | PriceGraduated | PriceVolume;
5478
5524
  /** Price. */
@@ -5777,52 +5823,12 @@ export interface VoidCreditGrantRequestInput {
5777
5823
  */
5778
5824
  paymentAdjustment?: 'none';
5779
5825
  }
5780
- /** Subscription create request. */
5781
- export interface SubscriptionCreateInput {
5782
- labels?: Labels;
5783
- /**
5784
- * Settlement mode for billing.
5785
- *
5786
- * Values:
5787
- *
5788
- * - `credit_then_invoice`: Credits are applied first, then any remainder is
5789
- * invoiced.
5790
- * - `credit_only`: Usage is settled exclusively against credits.
5791
- */
5792
- settlementMode?: 'credit_then_invoice' | 'credit_only';
5793
- /** The customer to create the subscription for. */
5794
- customer: {
5795
- id?: string;
5796
- key?: string;
5797
- };
5798
- /** The plan reference of the subscription. */
5799
- plan: {
5800
- id?: string;
5801
- key?: string;
5802
- version?: number;
5803
- };
5804
- /**
5805
- * A billing anchor is the fixed point in time that determines the subscription's
5806
- * recurring billing cycle. It affects when charges occur and how prorations are
5807
- * calculated. Common anchors:
5808
- *
5809
- * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
5810
- * - Subscription anniversary (day customer signed up)
5811
- * - Custom date (customer-specified day)
5812
- *
5813
- * If not provided, the subscription will be created with the subscription's
5814
- * creation time as the billing anchor.
5815
- */
5816
- billingAnchor?: Date;
5817
- /** Controls how custom-currency cost bases are selected for the subscription. */
5818
- costBasisMode?: 'dynamic' | 'pinned';
5819
- }
5820
5826
  /**
5821
5827
  * Unit conversion configuration.
5822
5828
  *
5823
5829
  * Transforms raw metered quantities into billing-ready units before pricing and
5824
- * entitlement evaluation. Applied at the rate card level so the same feature can
5825
- * be billed in different units across plans.
5830
+ * entitlement evaluation. Stored with a resource's rating configuration so the
5831
+ * same metered feature can be billed in different units across plans and charges.
5826
5832
  *
5827
5833
  * Examples:
5828
5834
  *
@@ -5875,6 +5881,46 @@ export interface UnitConfigInput {
5875
5881
  */
5876
5882
  displayUnit?: string;
5877
5883
  }
5884
+ /** Subscription create request. */
5885
+ export interface SubscriptionCreateInput {
5886
+ labels?: Labels;
5887
+ /**
5888
+ * Settlement mode for billing.
5889
+ *
5890
+ * Values:
5891
+ *
5892
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
5893
+ * invoiced.
5894
+ * - `credit_only`: Usage is settled exclusively against credits.
5895
+ */
5896
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
5897
+ /** The customer to create the subscription for. */
5898
+ customer: {
5899
+ id?: string;
5900
+ key?: string;
5901
+ };
5902
+ /** The plan reference of the subscription. */
5903
+ plan: {
5904
+ id?: string;
5905
+ key?: string;
5906
+ version?: number;
5907
+ };
5908
+ /**
5909
+ * A billing anchor is the fixed point in time that determines the subscription's
5910
+ * recurring billing cycle. It affects when charges occur and how prorations are
5911
+ * calculated. Common anchors:
5912
+ *
5913
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
5914
+ * - Subscription anniversary (day customer signed up)
5915
+ * - Custom date (customer-specified day)
5916
+ *
5917
+ * If not provided, the subscription will be created with the subscription's
5918
+ * creation time as the billing anchor.
5919
+ */
5920
+ billingAnchor?: Date;
5921
+ /** Controls how custom-currency cost bases are selected for the subscription. */
5922
+ costBasisMode?: 'dynamic' | 'pinned';
5923
+ }
5878
5924
  /** Invoice settings for a billing workflow. */
5879
5925
  export interface WorkflowInvoicingSettingsInput {
5880
5926
  /** Whether to automatically issue the invoice after the draftPeriod has passed. */
@@ -6376,6 +6422,108 @@ export interface WorkflowCollectionSettingsInput {
6376
6422
  */
6377
6423
  interval?: string;
6378
6424
  }
6425
+ /**
6426
+ * Usage-based intent fields from the system lifecycle controller shadowed by a
6427
+ * manual override.
6428
+ */
6429
+ export interface ChargeUsageBasedSystemIntentInput {
6430
+ /**
6431
+ * Display name of the resource.
6432
+ *
6433
+ * Between 1 and 256 characters.
6434
+ */
6435
+ name: string;
6436
+ /**
6437
+ * Optional description of the resource.
6438
+ *
6439
+ * Maximum 1024 characters.
6440
+ */
6441
+ description?: string;
6442
+ labels?: Labels;
6443
+ /** The timestamp when the charge is intended to be invoiced. */
6444
+ invoiceAt: Date;
6445
+ /** The effective service period covered by the charge. */
6446
+ servicePeriod: ClosedPeriod;
6447
+ /** The full, unprorated service period of the charge. */
6448
+ fullServicePeriod: ClosedPeriod;
6449
+ /** The billing period the charge belongs to. */
6450
+ billingPeriod: ClosedPeriod;
6451
+ /** Discounts applied to the usage-based charge. */
6452
+ discounts?: RateCardDiscounts;
6453
+ /** The price of the charge. */
6454
+ price: PriceUsageBased;
6455
+ /** Spend commitments for the charge. */
6456
+ commitments?: SpendCommitments;
6457
+ /**
6458
+ * Unit conversion configuration for the charge.
6459
+ *
6460
+ * Synthesized on read for charges created from v1 dynamic or package prices:
6461
+ * dynamic prices map to a unit price with a multiply unit config, and package
6462
+ * prices map to a unit price with a divide unit config.
6463
+ *
6464
+ * Accepted on create only when the UnitConfig feature is enabled on the
6465
+ * deployment; otherwise rejected.
6466
+ */
6467
+ unitConfig?: UnitConfigInput;
6468
+ /**
6469
+ * The timestamp when the system lifecycle controller intent was deleted. The
6470
+ * effective charge can remain visible while a manual override is active.
6471
+ */
6472
+ deletedAt?: Date;
6473
+ }
6474
+ /** Usage-based charge create request. */
6475
+ export interface CreateChargeUsageBasedRequestInput {
6476
+ /**
6477
+ * Display name of the resource.
6478
+ *
6479
+ * Between 1 and 256 characters.
6480
+ */
6481
+ name: string;
6482
+ /**
6483
+ * Optional description of the resource.
6484
+ *
6485
+ * Maximum 1024 characters.
6486
+ */
6487
+ description?: string;
6488
+ labels?: Labels;
6489
+ /** The type of the charge. */
6490
+ type: 'usage_based';
6491
+ /** The currency of the charge. */
6492
+ currency: string;
6493
+ /** The timestamp when the charge is intended to be invoiced. */
6494
+ invoiceAt: Date;
6495
+ /** The effective service period covered by the charge. */
6496
+ servicePeriod: ClosedPeriod;
6497
+ /** Unique reference ID of the charge. */
6498
+ uniqueReferenceId?: string;
6499
+ /** Settlement mode of the charge. */
6500
+ settlementMode: 'credit_then_invoice' | 'credit_only';
6501
+ /** Tax configuration of the charge. */
6502
+ taxConfig?: TaxConfig;
6503
+ /** Discounts applied to the usage-based charge. */
6504
+ discounts?: RateCardDiscounts;
6505
+ /** The feature ID associated with the charge. */
6506
+ featureId: string;
6507
+ /** The price of the charge. */
6508
+ price: PriceUsageBased;
6509
+ /** Spend commitments for the charge. */
6510
+ commitments?: SpendCommitments;
6511
+ /**
6512
+ * Unit conversion configuration for the charge.
6513
+ *
6514
+ * Synthesized on read for charges created from v1 dynamic or package prices:
6515
+ * dynamic prices map to a unit price with a multiply unit config, and package
6516
+ * prices map to a unit price with a divide unit config.
6517
+ *
6518
+ * Accepted on create only when the UnitConfig feature is enabled on the
6519
+ * deployment; otherwise rejected.
6520
+ */
6521
+ unitConfig?: UnitConfigInput;
6522
+ /** The full, unprorated service period of the charge. */
6523
+ fullServicePeriod?: ClosedPeriod;
6524
+ /** The billing period the charge belongs to. */
6525
+ billingPeriod?: ClosedPeriod;
6526
+ }
6379
6527
  /** A rate card defines the pricing and entitlement of a feature or service. */
6380
6528
  export interface RateCardInput {
6381
6529
  /**
@@ -6464,6 +6612,95 @@ export interface WorkflowInput {
6464
6612
  /** The tax settings for this workflow */
6465
6613
  tax?: WorkflowTaxSettingsInput;
6466
6614
  }
6615
+ /** A usage-based charge for a customer. */
6616
+ export interface ChargeUsageBasedInput {
6617
+ id: string;
6618
+ /**
6619
+ * Display name of the resource.
6620
+ *
6621
+ * Between 1 and 256 characters.
6622
+ */
6623
+ name: string;
6624
+ /**
6625
+ * Optional description of the resource.
6626
+ *
6627
+ * Maximum 1024 characters.
6628
+ */
6629
+ description?: string;
6630
+ labels?: Labels;
6631
+ /** An ISO-8601 timestamp representation of entity creation date. */
6632
+ createdAt: Date;
6633
+ /** An ISO-8601 timestamp representation of entity last update date. */
6634
+ updatedAt: Date;
6635
+ /** An ISO-8601 timestamp representation of entity deletion date. */
6636
+ deletedAt?: Date;
6637
+ /** The type of the charge. */
6638
+ type: 'usage_based';
6639
+ /** The customer owning the charge. */
6640
+ customer: BillingCustomerReference;
6641
+ /**
6642
+ * Indicates whether the charge lifecycle is controlled by OpenMeter or manually
6643
+ * overridden by the API user.
6644
+ */
6645
+ lifecycleController: 'system' | 'manual';
6646
+ /**
6647
+ * The subscription that originated the charge, when the charge was created from a
6648
+ * subscription item.
6649
+ */
6650
+ subscription?: SubscriptionReference;
6651
+ /** The currency of the charge. */
6652
+ currency: string;
6653
+ /** The lifecycle status of the charge. */
6654
+ status: 'created' | 'active' | 'final' | 'deleted';
6655
+ /** The timestamp when the charge is intended to be invoiced. */
6656
+ invoiceAt: Date;
6657
+ /** The effective service period covered by the charge. */
6658
+ servicePeriod: ClosedPeriod;
6659
+ /** The full, unprorated service period of the charge. */
6660
+ fullServicePeriod: ClosedPeriod;
6661
+ /** The billing period the charge belongs to. */
6662
+ billingPeriod: ClosedPeriod;
6663
+ /**
6664
+ * The earliest time when the charge should be advanced again by background
6665
+ * processing.
6666
+ */
6667
+ advanceAfter?: Date;
6668
+ /** Unique reference ID of the charge. */
6669
+ uniqueReferenceId?: string;
6670
+ /** Settlement mode of the charge. */
6671
+ settlementMode: 'credit_then_invoice' | 'credit_only';
6672
+ /** Tax configuration of the charge. */
6673
+ taxConfig?: TaxConfig;
6674
+ /** Discounts applied to the usage-based charge. */
6675
+ discounts?: RateCardDiscounts;
6676
+ /** The feature associated with the charge. */
6677
+ featureKey: string;
6678
+ /** The feature ID associated with the charge. */
6679
+ featureId: string;
6680
+ /** Aggregated booked and realtime totals for the charge. */
6681
+ totals: ChargeTotals;
6682
+ /** The price of the charge. */
6683
+ price: PriceUsageBased;
6684
+ /** Spend commitments for the charge. */
6685
+ commitments?: SpendCommitments;
6686
+ /**
6687
+ * Unit conversion configuration for the charge.
6688
+ *
6689
+ * Synthesized on read for charges created from v1 dynamic or package prices:
6690
+ * dynamic prices map to a unit price with a multiply unit config, and package
6691
+ * prices map to a unit price with a divide unit config.
6692
+ *
6693
+ * Accepted on create only when the UnitConfig feature is enabled on the
6694
+ * deployment; otherwise rejected.
6695
+ */
6696
+ unitConfig?: UnitConfigInput;
6697
+ /**
6698
+ * Current intent from the system lifecycle controller for a charge that has an
6699
+ * active manual override. The top-level charge fields remain the effective
6700
+ * customer-facing intent.
6701
+ */
6702
+ systemIntent?: ChargeUsageBasedSystemIntentInput;
6703
+ }
6467
6704
  /** A subscription item pins a rate card to a cadence within a subscription phase. */
6468
6705
  export interface SubscriptionItemInput {
6469
6706
  /** The unique identifier of the subscription item instance. */
@@ -7013,6 +7250,11 @@ export interface ProfilePagePaginatedResponseInput {
7013
7250
  data: ProfileInput[];
7014
7251
  meta: PaginatedMeta;
7015
7252
  }
7253
+ /** Page paginated response. */
7254
+ export interface ChargePagePaginatedResponseInput {
7255
+ data: ChargeInput[];
7256
+ meta: PaginatedMeta;
7257
+ }
7016
7258
  /** Subscription. */
7017
7259
  export interface SubscriptionInput {
7018
7260
  id: string;
@@ -7247,6 +7489,10 @@ export type UpdateBillingWorkflowPaymentSettingsInput = UpdateBillingWorkflowPay
7247
7489
  * rate card itself, so it is omitted here.
7248
7490
  */
7249
7491
  export type RateCardEntitlementInput = RateCardMeteredEntitlementInput | RateCardStaticEntitlement | RateCardBooleanEntitlement;
7492
+ /** Customer charge. */
7493
+ export type CreateChargeRequestInput = CreateChargeFlatFeeRequest | CreateChargeUsageBasedRequestInput;
7494
+ /** Customer charge. */
7495
+ export type ChargeInput = ChargeFlatFee | ChargeUsageBasedInput;
7250
7496
  /**
7251
7497
  * A top-level line item on an invoice.
7252
7498
  *