@openmeter/client 1.0.0-beta-c16cbe1e4650 → 1.0.0-beta-d30d21dce71a

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.
@@ -121,7 +121,7 @@ export interface TaxConfigExternalInvoicing {
121
121
  code: string;
122
122
  }
123
123
  /** Discounts applicable to flat fee charges. This is the same as `ProductCatalog.Discounts` but without the `usage` field, which is not applicable to flat fee charges. */
124
- export interface FlatFeeDiscounts {
124
+ export interface ChargeFlatFeeDiscounts {
125
125
  /** Percentage discount applied to the price (0–100). */
126
126
  percentage?: number;
127
127
  }
@@ -147,6 +147,30 @@ export interface WorkflowPaymentSendInvoiceSettings {
147
147
  /** The period after which the invoice is due. With some payment solutions it's only applicable for manual collection method. */
148
148
  due_after: string;
149
149
  }
150
+ /** External identifiers assigned to an invoice by third-party systems. */
151
+ export interface InvoiceExternalReferences {
152
+ /** The ID assigned by the external invoicing app (e.g. Stripe invoice ID). */
153
+ invoicing_id?: string;
154
+ /** The ID assigned by the external payment app (e.g. Stripe payment intent ID). */
155
+ payment_id?: string;
156
+ }
157
+ /** Details about an available invoice action including the resulting state. */
158
+ export interface InvoiceAvailableActionDetails {
159
+ /** The extended status the invoice will transition to after performing this action. */
160
+ resulting_state: string;
161
+ }
162
+ /** Invoice-level invoicing settings. A subset of BillingWorkflowInvoicingSettings limited to fields that are meaningful per-invoice. progressive_billing is omitted as it is a gather-time / profile-level decision. */
163
+ export interface InvoiceWorkflowInvoicingSettings {
164
+ /** Whether to automatically issue the invoice after the draft_period has passed. */
165
+ auto_advance: boolean;
166
+ /** The period for the invoice to be kept in draft status for manual reviews. */
167
+ draft_period: string;
168
+ }
169
+ /** External identifiers for an invoice line item assigned by third-party systems. */
170
+ export interface InvoiceLineExternalReferences {
171
+ /** The ID assigned by the external invoicing app. */
172
+ invoicing_id?: string;
173
+ }
150
174
  /** LLM Provider */
151
175
  export interface LlmCostProvider {
152
176
  /** Identifier of the provider, e.g., "openai", "anthropic". */
@@ -342,6 +366,13 @@ export interface Totals {
342
366
  /** The final total value of the resource after taxes, discounts and commitments. */
343
367
  total: string;
344
368
  }
369
+ /** A credit allocation applied to an invoice line item. */
370
+ export interface InvoiceLineCreditsApplied {
371
+ /** The monetary amount credited. */
372
+ amount: string;
373
+ /** Optional human-readable description of the credit allocation. */
374
+ description?: string;
375
+ }
345
376
  /** A fixed per-unit cost amount. */
346
377
  export interface FeatureManualUnitCost {
347
378
  /** The type discriminator for manual unit cost. */
@@ -563,6 +594,11 @@ export interface AppReference {
563
594
  /** The ID of the app. */
564
595
  id: string;
565
596
  }
597
+ /** Reference to a charge associated with an invoice line. */
598
+ export interface ChargeReference {
599
+ /** Unique identifier for the charge. */
600
+ id: string;
601
+ }
566
602
  /** Currency describes a currency supported by the billing system. */
567
603
  export interface CurrencyFiat {
568
604
  id: string;
@@ -941,23 +977,6 @@ export interface CustomerUsageAttribution {
941
977
  subject_keys: string[];
942
978
  }
943
979
  /** Address */
944
- export interface BillingAddress {
945
- /** Country code in [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2 format. */
946
- country?: string;
947
- /** Postal code. */
948
- postal_code?: string;
949
- /** State or province. */
950
- state?: string;
951
- /** City. */
952
- city?: string;
953
- /** First line of the address. */
954
- line1?: string;
955
- /** Second line of the address. */
956
- line2?: string;
957
- /** Phone number. */
958
- phone_number?: string;
959
- }
960
- /** Address */
961
980
  export interface Address {
962
981
  /** Country code in [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2 format. */
963
982
  country?: string;
@@ -1245,6 +1264,69 @@ export interface WorkflowInvoicingSettings {
1245
1264
  /** Controls how subscription-ending shortened service periods are billed. */
1246
1265
  subscription_end_proration_mode: 'bill_full_period' | 'bill_actual_period';
1247
1266
  }
1267
+ /** A validation issue found during invoice processing. Converges on the same structure used by plan and subscription validation errors: a machine-readable `code`, a human-readable `message`, optional structured `attributes`, plus a `severity` and optional `field` path. */
1268
+ export interface InvoiceValidationIssue {
1269
+ /** Machine-readable error code. */
1270
+ code: string;
1271
+ /** Human-readable description of the error. */
1272
+ message: string;
1273
+ /** Additional structured context. */
1274
+ attributes?: Record<string, unknown>;
1275
+ /** Severity of the validation issue. */
1276
+ severity: 'critical' | 'warning';
1277
+ /** JSON path to the field that caused this validation issue, if applicable. For example: `lines/0/rate_card/price`. */
1278
+ field?: string;
1279
+ }
1280
+ /** The set of state-transition actions available for an invoice in its current status. A field is present only when that action is permitted from the current state. */
1281
+ export interface InvoiceAvailableActions {
1282
+ /** Advance the invoice to the next workflow step. */
1283
+ advance?: InvoiceAvailableActionDetails;
1284
+ /** Approve the invoice for issuance. */
1285
+ approve?: InvoiceAvailableActionDetails;
1286
+ /** Delete the invoice. */
1287
+ delete?: InvoiceAvailableActionDetails;
1288
+ /** Retry a failed workflow step. */
1289
+ retry?: InvoiceAvailableActionDetails;
1290
+ /** Snapshot the current usage quantities. */
1291
+ snapshot_quantities?: InvoiceAvailableActionDetails;
1292
+ }
1293
+ /** A monetary amount discount applied to an invoice line item. */
1294
+ export interface InvoiceLineAmountDiscount {
1295
+ /** Unique identifier for the discount. */
1296
+ id: string;
1297
+ /** The reason this discount was applied. */
1298
+ reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
1299
+ /** Optional human-readable description of the discount. */
1300
+ description?: string;
1301
+ /** External identifiers for this discount. */
1302
+ external_references?: InvoiceLineExternalReferences;
1303
+ /** The monetary amount deducted. */
1304
+ amount: string;
1305
+ }
1306
+ /** A usage quantity discount applied to an invoice line item. */
1307
+ export interface InvoiceLineUsageDiscount {
1308
+ /** Unique identifier for the discount. */
1309
+ id: string;
1310
+ /** The reason this discount was applied. */
1311
+ reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
1312
+ /** Optional human-readable description of the discount. */
1313
+ description?: string;
1314
+ /** External identifiers for this discount. */
1315
+ external_references?: InvoiceLineExternalReferences;
1316
+ /** The usage quantity deducted (in billing units). */
1317
+ quantity: string;
1318
+ }
1319
+ /** Base fields shared by all invoice line item discounts. */
1320
+ export interface InvoiceLineBaseDiscount {
1321
+ /** Unique identifier for the discount. */
1322
+ id: string;
1323
+ /** The reason this discount was applied. */
1324
+ reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
1325
+ /** Optional human-readable description of the discount. */
1326
+ description?: string;
1327
+ /** External identifiers for this discount. */
1328
+ external_references?: InvoiceLineExternalReferences;
1329
+ }
1248
1330
  /** Filter options for listing currencies. */
1249
1331
  export interface ListCurrenciesParamsFilter {
1250
1332
  type?: 'fiat' | 'custom';
@@ -1782,6 +1864,15 @@ export interface ProfileAppReferences {
1782
1864
  /** The payment app used for this workflow. */
1783
1865
  payment: AppReference;
1784
1866
  }
1867
+ /** BillingInvoiceWorkflowAppsReferences represents the references (id) to the apps used by a billing profile */
1868
+ export interface InvoiceWorkflowAppsReferences {
1869
+ /** The tax app used for this workflow */
1870
+ tax: AppReference;
1871
+ /** The invoicing app used for this workflow */
1872
+ invoicing: AppReference;
1873
+ /** The payment app used for this workflow */
1874
+ payment: AppReference;
1875
+ }
1785
1876
  /** Filter options for listing ingested events. */
1786
1877
  export interface ListEventsParamsFilter {
1787
1878
  /** Filter events by ID. */
@@ -2018,7 +2109,7 @@ export interface CreateCustomerRequest {
2018
2109
  /** Currency of the customer. Used for billing, tax and invoicing. */
2019
2110
  currency?: string;
2020
2111
  /** The billing address of the customer. Used for tax and invoicing. */
2021
- billing_address?: BillingAddress;
2112
+ billing_address?: Address;
2022
2113
  }
2023
2114
  /** Customers can be individuals or organizations that can subscribe to plans and have access to features. */
2024
2115
  export interface Customer {
@@ -2042,7 +2133,7 @@ export interface Customer {
2042
2133
  /** Currency of the customer. Used for billing, tax and invoicing. */
2043
2134
  currency?: string;
2044
2135
  /** The billing address of the customer. Used for tax and invoicing. */
2045
- billing_address?: BillingAddress;
2136
+ billing_address?: Address;
2046
2137
  }
2047
2138
  /** Customer upsert request. */
2048
2139
  export interface UpsertCustomerRequest {
@@ -2058,13 +2149,25 @@ export interface UpsertCustomerRequest {
2058
2149
  /** Currency of the customer. Used for billing, tax and invoicing. */
2059
2150
  currency?: string;
2060
2151
  /** The billing address of the customer. Used for tax and invoicing. */
2061
- billing_address?: BillingAddress;
2152
+ billing_address?: Address;
2062
2153
  }
2063
2154
  /** A collection of addresses for the party. */
2064
2155
  export interface PartyAddresses {
2065
2156
  /** Billing address. */
2066
2157
  billing_address: Address;
2067
2158
  }
2159
+ /** Snapshot of the customer's information at the time the invoice was issued. */
2160
+ export interface InvoiceCustomer {
2161
+ id: string;
2162
+ /** Display name of the resource. Between 1 and 256 characters. */
2163
+ name: string;
2164
+ /** Mapping to attribute metered usage to the customer by the event subject. */
2165
+ usage_attribution?: CustomerUsageAttribution;
2166
+ /** The billing address of the customer. Used for tax and invoicing. */
2167
+ billing_address?: Address;
2168
+ /** Optional external resource key for the customer. Omitted when the customer was created without a key. Unlike on the customer resource itself, the key is optional here because the invoice snapshot may predate or omit it. */
2169
+ key?: string;
2170
+ }
2068
2171
  /** Checkout Session consent collection configuration. */
2069
2172
  export interface AppStripeCreateCheckoutSessionConsentCollection {
2070
2173
  /** Controls the visibility of payment method reuse agreement. */
@@ -2238,6 +2341,31 @@ export interface UpsertTaxCodeRequest {
2238
2341
  /** Mapping of app types to tax codes. */
2239
2342
  app_mappings: TaxCodeAppMapping[];
2240
2343
  }
2344
+ /** Invoice-level snapshot of the workflow configuration. Contains only the settings that are meaningful for an already-created invoice: invoicing behaviour and payment settings. Collection alignment and tax policy are gather-time / profile-wide concerns and are not included. */
2345
+ export interface InvoiceWorkflow {
2346
+ /** Invoicing settings for this invoice. */
2347
+ invoicing?: InvoiceWorkflowInvoicingSettings;
2348
+ /** Payment settings for this invoice. */
2349
+ payment?: WorkflowPaymentChargeAutomaticallySettings | WorkflowPaymentSendInvoiceSettings;
2350
+ }
2351
+ /** Detailed status information for a standard invoice. */
2352
+ export interface InvoiceStatusDetails {
2353
+ /** Whether the invoice is immutable (i.e. cannot be modified or deleted). */
2354
+ immutable: boolean;
2355
+ /** Whether the invoice is in a failed state. */
2356
+ failed: boolean;
2357
+ /** Fine-grained internal status string providing additional workflow detail beyond the top-level status enum. */
2358
+ extended_status: string;
2359
+ /** The set of state-transition actions currently available for this invoice. */
2360
+ available_actions: InvoiceAvailableActions;
2361
+ }
2362
+ /** Discounts applied to an invoice line item. */
2363
+ export interface InvoiceLineDiscounts {
2364
+ /** Monetary amount discounts (e.g. from maximum spend commitments). */
2365
+ amount?: InvoiceLineAmountDiscount[];
2366
+ /** Usage quantity discounts (e.g. free tier usage allowances). */
2367
+ usage?: InvoiceLineUsageDiscount[];
2368
+ }
2241
2369
  /** Usage quantity details on an invoice line item when UnitConfig is in effect. Provides the full audit trail from raw meter output to the invoiced amount. */
2242
2370
  export interface InvoiceUsageQuantityDetail {
2243
2371
  /** The raw quantity as reported by the meter (native units). */
@@ -2365,7 +2493,7 @@ export interface CreditGrant {
2365
2493
  status: 'pending' | 'active' | 'expired' | 'voided';
2366
2494
  }
2367
2495
  /** Flat fee charge create request. */
2368
- export interface CreateFlatFeeChargeRequest {
2496
+ export interface CreateChargeFlatFeeRequest {
2369
2497
  /** Display name of the resource. Between 1 and 256 characters. */
2370
2498
  name: string;
2371
2499
  /** Optional description of the resource. Maximum 1024 characters. */
@@ -2388,7 +2516,7 @@ export interface CreateFlatFeeChargeRequest {
2388
2516
  /** Payment term of the flat fee charge. */
2389
2517
  payment_term: 'in_advance' | 'in_arrears';
2390
2518
  /** The discounts applied to the charge. */
2391
- discounts?: FlatFeeDiscounts;
2519
+ discounts?: ChargeFlatFeeDiscounts;
2392
2520
  /** The feature associated with the charge, when applicable. */
2393
2521
  feature_key?: string;
2394
2522
  /** The proration configuration of the charge. */
@@ -2459,6 +2587,17 @@ export interface Party {
2459
2587
  /** Address for where information should be sent if needed. */
2460
2588
  addresses?: PartyAddresses;
2461
2589
  }
2590
+ /** Snapshot of the supplier's information at the time the invoice was issued. Structurally a read-only subset of `BillingParty` (the type configured on the billing profile), so the snapshot stays aligned with the source. `key` is omitted because it is not part of the snapshotted supplier data. */
2591
+ export interface Supplier {
2592
+ /** Unique identifier for the party. */
2593
+ id?: string;
2594
+ /** Legal name or representation of the party. */
2595
+ name?: string;
2596
+ /** The entity's legal identification used for tax purposes. They may have other numbers, but we're only interested in those valid for tax purposes. */
2597
+ tax_id?: PartyTaxIdentity;
2598
+ /** Address for where information should be sent if needed. */
2599
+ addresses?: PartyAddresses;
2600
+ }
2462
2601
  /** Configuration options for creating a Stripe Checkout Session. Based on Stripe's [Checkout Session API parameters](https://docs.stripe.com/api/checkout/sessions/create). */
2463
2602
  export interface AppStripeCreateCheckoutSessionRequestOptions {
2464
2603
  /** Whether to collect the customer's billing address. Defaults to auto, which only collects the address when necessary for tax calculation. */
@@ -2499,6 +2638,46 @@ export interface TaxCodePagePaginatedResponse {
2499
2638
  data: TaxCode[];
2500
2639
  meta: PaginatedMeta;
2501
2640
  }
2641
+ /** Snapshot of the billing workflow configuration captured at invoice creation. */
2642
+ export interface InvoiceWorkflowSettings {
2643
+ /** The apps that will be used to orchestrate the invoice's workflow. */
2644
+ apps?: InvoiceWorkflowAppsReferences;
2645
+ /** The billing profile that was the source of this workflow snapshot. */
2646
+ source_billing_profile: ProfileReference;
2647
+ /** The workflow configuration that was active when the invoice was created. Only the fields that are meaningful at the per-invoice level are included: invoicing behaviour (auto-advance, draft period) and payment settings (collection method, due date). Profile-wide settings such as collection alignment, progressive billing, and tax policy are omitted. */
2648
+ workflow: InvoiceWorkflow;
2649
+ }
2650
+ /** A detailed (child) sub-line belonging to a parent invoice line. Detailed lines represent the individual flat-fee components that make up a usage-based parent line after quantity snapshotting. */
2651
+ export interface InvoiceDetailedLine {
2652
+ id: string;
2653
+ /** Display name of the resource. Between 1 and 256 characters. */
2654
+ name: string;
2655
+ /** Optional description of the resource. Maximum 1024 characters. */
2656
+ description?: string;
2657
+ labels?: Labels;
2658
+ /** An ISO-8601 timestamp representation of entity creation date. */
2659
+ created_at: string;
2660
+ /** An ISO-8601 timestamp representation of entity last update date. */
2661
+ updated_at: string;
2662
+ /** An ISO-8601 timestamp representation of entity deletion date. */
2663
+ deleted_at?: string;
2664
+ /** The service period covered by this detailed line. */
2665
+ service_period: ClosedPeriod;
2666
+ /** Aggregated financial totals for the detailed line. */
2667
+ totals: Totals;
2668
+ /** The cost category of this detailed line. */
2669
+ category: 'regular' | 'commitment';
2670
+ /** Discounts applied to this detailed line. */
2671
+ discounts?: InvoiceLineDiscounts;
2672
+ /** Credit applied to this detailed line. */
2673
+ credits_applied?: InvoiceLineCreditsApplied[];
2674
+ /** External identifiers for this detailed line. */
2675
+ external_references?: InvoiceLineExternalReferences;
2676
+ /** The quantity of the detailed line. */
2677
+ quantity: string;
2678
+ /** The unit price of the detailed line. */
2679
+ unit_price: string;
2680
+ }
2502
2681
  /** Page paginated response. */
2503
2682
  export interface CurrencyPagePaginatedResponse {
2504
2683
  data: (CurrencyFiat | CurrencyCustom)[];
@@ -2563,6 +2742,35 @@ export interface BadRequest extends BaseError {
2563
2742
  /** The list of parameters that failed validation. */
2564
2743
  invalid_parameters: (InvalidParameterStandard | InvalidParameterMinimumLength | InvalidParameterMaximumLength | InvalidParameterChoiceItem | InvalidParameterDependentItem)[];
2565
2744
  }
2745
+ /** Base fields shared by all invoice types. Spread this model into each concrete invoice variant. */
2746
+ export interface InvoiceBase {
2747
+ id: string;
2748
+ /** Optional description of the resource. Maximum 1024 characters. */
2749
+ description?: string;
2750
+ labels?: Labels;
2751
+ /** An ISO-8601 timestamp representation of entity creation date. */
2752
+ created_at: string;
2753
+ /** An ISO-8601 timestamp representation of entity last update date. */
2754
+ updated_at: string;
2755
+ /** An ISO-8601 timestamp representation of entity deletion date. */
2756
+ deleted_at?: string;
2757
+ /** Human-readable invoice number generated by the invoicing app. */
2758
+ number: string;
2759
+ /** Three-letter ISO 4217 currency code for the invoice. */
2760
+ currency: string;
2761
+ /** Snapshot of the supplier's contact information at the time the invoice was issued. */
2762
+ supplier: Supplier;
2763
+ /** Snapshot of the customer's information at the time the invoice was issued. */
2764
+ customer: InvoiceCustomer;
2765
+ /** Aggregated financial totals for the invoice. */
2766
+ totals: Totals;
2767
+ /** The service period covered by this invoice. For flat fee the service period can be empty which means `from` will be equals to `to`. In other cases those fields will be filled with the actual service period. */
2768
+ service_period: ClosedPeriod;
2769
+ /** Validation issues found during invoice processing. Present only when there are one or more validation findings. An empty list is omitted. */
2770
+ validation_issues?: InvoiceValidationIssue[];
2771
+ /** External identifiers assigned to this invoice by third-party systems. */
2772
+ external_references?: InvoiceExternalReferences;
2773
+ }
2566
2774
  /** Request to create a Stripe Checkout Session for the customer. Checkout Sessions are used to collect payment method information from customers in a secure, Stripe-hosted interface. This integration uses setup mode to collect payment methods that can be charged later for subscription billing. */
2567
2775
  export interface CustomerStripeCreateCheckoutSessionRequest {
2568
2776
  /** Options for configuring the Stripe Checkout Session. These options are passed directly to Stripe's [checkout session creation API](https://docs.stripe.com/api/checkout/sessions/create). */
@@ -2599,7 +2807,7 @@ export interface GovernanceQueryResponse {
2599
2807
  meta: CursorMeta;
2600
2808
  }
2601
2809
  /** A flat fee charge for a customer. */
2602
- export interface FlatFeeCharge {
2810
+ export interface ChargeFlatFee {
2603
2811
  id: string;
2604
2812
  /** Display name of the resource. Between 1 and 256 characters. */
2605
2813
  name: string;
@@ -2616,8 +2824,8 @@ export interface FlatFeeCharge {
2616
2824
  type: 'flat_fee';
2617
2825
  /** The customer owning the charge. */
2618
2826
  customer: BillingCustomerReference;
2619
- /** The charge is managed by the following entity. */
2620
- managed_by: 'manual' | 'system' | 'subscription';
2827
+ /** Indicates whether the charge lifecycle is controlled by OpenMeter or manually overridden by the API user. */
2828
+ lifecycle_controller: 'system' | 'manual';
2621
2829
  /** The subscription that originated the charge, when the charge was created from a subscription item. */
2622
2830
  subscription?: SubscriptionReference;
2623
2831
  /** The currency of the charge. */
@@ -2643,7 +2851,7 @@ export interface FlatFeeCharge {
2643
2851
  /** Payment term of the flat fee charge. */
2644
2852
  payment_term: 'in_advance' | 'in_arrears';
2645
2853
  /** The discounts applied to the charge. */
2646
- discounts?: FlatFeeDiscounts;
2854
+ discounts?: ChargeFlatFeeDiscounts;
2647
2855
  /** The feature associated with the charge, when applicable. */
2648
2856
  feature_key?: string;
2649
2857
  /** The proration configuration of the charge. */
@@ -2656,7 +2864,7 @@ export interface FlatFeeCharge {
2656
2864
  price: PriceFree | PriceFlat | PriceUnit | PriceGraduated | PriceVolume;
2657
2865
  }
2658
2866
  /** A usage-based charge for a customer. */
2659
- export interface UsageBasedCharge {
2867
+ export interface ChargeUsageBased {
2660
2868
  id: string;
2661
2869
  /** Display name of the resource. Between 1 and 256 characters. */
2662
2870
  name: string;
@@ -2673,8 +2881,8 @@ export interface UsageBasedCharge {
2673
2881
  type: 'usage_based';
2674
2882
  /** The customer owning the charge. */
2675
2883
  customer: BillingCustomerReference;
2676
- /** The charge is managed by the following entity. */
2677
- managed_by: 'manual' | 'system' | 'subscription';
2884
+ /** Indicates whether the charge lifecycle is controlled by OpenMeter or manually overridden by the API user. */
2885
+ lifecycle_controller: 'system' | 'manual';
2678
2886
  /** The subscription that originated the charge, when the charge was created from a subscription item. */
2679
2887
  subscription?: SubscriptionReference;
2680
2888
  /** The currency of the charge. */
@@ -2707,7 +2915,7 @@ export interface UsageBasedCharge {
2707
2915
  price: PriceFree | PriceFlat | PriceUnit | PriceGraduated | PriceVolume;
2708
2916
  }
2709
2917
  /** Usage-based charge create request. */
2710
- export interface CreateUsageBasedChargeRequest {
2918
+ export interface CreateChargeUsageBasedRequest {
2711
2919
  /** Display name of the resource. Between 1 and 256 characters. */
2712
2920
  name: string;
2713
2921
  /** Optional description of the resource. Maximum 1024 characters. */
@@ -2738,6 +2946,17 @@ export interface CreateUsageBasedChargeRequest {
2738
2946
  /** The billing period the charge belongs to. */
2739
2947
  billing_period?: ClosedPeriod;
2740
2948
  }
2949
+ /** Rate card configuration snapshot for a usage-based invoice line. */
2950
+ export interface InvoiceLineRateCard {
2951
+ /** The price definition used to calculate charges for this line. */
2952
+ price: PriceFree | PriceFlat | PriceUnit | PriceGraduated | PriceVolume;
2953
+ /** Tax configuration snapshot for this line. */
2954
+ tax_config?: RateCardTaxConfig;
2955
+ /** The feature key associated with this line's rate card. */
2956
+ feature_key?: string;
2957
+ /** Discount configuration from the rate card. */
2958
+ discounts?: RateCardDiscounts;
2959
+ }
2741
2960
  /** A rate card defines the pricing and entitlement of a feature or service. */
2742
2961
  export interface RateCard {
2743
2962
  /** Display name of the resource. Between 1 and 256 characters. */
@@ -2781,6 +3000,43 @@ export interface Workflow {
2781
3000
  /** The tax settings for this workflow */
2782
3001
  tax?: WorkflowTaxSettings;
2783
3002
  }
3003
+ /** A top-level line item on an invoice. Each line represents a single charge, typically associated with a rate card from a subscription. Detailed (child) lines are nested under `detailed_lines` when present. */
3004
+ export interface InvoiceStandardLine {
3005
+ id: string;
3006
+ /** Display name of the resource. Between 1 and 256 characters. */
3007
+ name: string;
3008
+ /** Optional description of the resource. Maximum 1024 characters. */
3009
+ description?: string;
3010
+ labels?: Labels;
3011
+ /** An ISO-8601 timestamp representation of entity creation date. */
3012
+ created_at: string;
3013
+ /** An ISO-8601 timestamp representation of entity last update date. */
3014
+ updated_at: string;
3015
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3016
+ deleted_at?: string;
3017
+ /** The type of charge this line item represents. */
3018
+ type: 'standard_line';
3019
+ /** Indicates whether this line item's lifecycle is controlled by OpenMeter or manually overridden by the API user. */
3020
+ lifecycle_controller: 'system' | 'manual';
3021
+ /** The service period covered by this invoice, spanning the earliest line start to the latest line end across all of its lines. For an invoice with no lines the period is empty, which means `from` will be equal to `to`. */
3022
+ service_period: ClosedPeriod;
3023
+ /** Aggregated financial totals for the line item. */
3024
+ totals: Totals;
3025
+ /** Discounts applied to this line item. */
3026
+ discounts?: InvoiceLineDiscounts;
3027
+ /** Credit applied to this line item. */
3028
+ credits_applied?: InvoiceLineCreditsApplied[];
3029
+ /** External identifiers for this line item assigned by third-party systems. */
3030
+ external_references?: InvoiceLineExternalReferences;
3031
+ /** Reference to the subscription item that generated this line. */
3032
+ subscription?: SubscriptionReference;
3033
+ /** The rate card configuration snapshot used to price this line item. */
3034
+ rate_card: InvoiceLineRateCard;
3035
+ /** Detailed sub-lines that this line has been broken down into. Present when line has individual details. */
3036
+ detailed_lines: InvoiceDetailedLine[];
3037
+ /** Reference to the charge associated with this line item. */
3038
+ charge?: ChargeReference;
3039
+ }
2784
3040
  /** The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses. */
2785
3041
  export interface PlanPhase {
2786
3042
  /** Display name of the resource. Between 1 and 256 characters. */
@@ -2910,7 +3166,7 @@ export interface UpsertBillingProfileRequest {
2910
3166
  }
2911
3167
  /** Page paginated response. */
2912
3168
  export interface ChargePagePaginatedResponse {
2913
- data: (FlatFeeCharge | UsageBasedCharge)[];
3169
+ data: (ChargeFlatFee | ChargeUsageBased)[];
2914
3170
  meta: PaginatedMeta;
2915
3171
  }
2916
3172
  /** Plans provide a template for subscriptions. */
@@ -2990,6 +3246,57 @@ export interface ProfilePagePaginatedResponse {
2990
3246
  data: Profile[];
2991
3247
  meta: PaginatedMeta;
2992
3248
  }
3249
+ /** A standard invoice for charges owed by the customer. */
3250
+ export interface InvoiceStandard {
3251
+ id: string;
3252
+ /** Optional description of the resource. Maximum 1024 characters. */
3253
+ description?: string;
3254
+ labels?: Labels;
3255
+ /** An ISO-8601 timestamp representation of entity creation date. */
3256
+ created_at: string;
3257
+ /** An ISO-8601 timestamp representation of entity last update date. */
3258
+ updated_at: string;
3259
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3260
+ deleted_at?: string;
3261
+ /** Human-readable invoice number generated by the invoicing app. */
3262
+ number: string;
3263
+ /** Three-letter ISO 4217 currency code for the invoice. */
3264
+ currency: string;
3265
+ /** Snapshot of the supplier's contact information at the time the invoice was issued. */
3266
+ supplier: Supplier;
3267
+ /** Snapshot of the customer's information at the time the invoice was issued. */
3268
+ customer: InvoiceCustomer;
3269
+ /** Aggregated financial totals for the invoice. */
3270
+ totals: Totals;
3271
+ /** The service period covered by this invoice. For flat fee the service period can be empty which means `from` will be equals to `to`. In other cases those fields will be filled with the actual service period. */
3272
+ service_period: ClosedPeriod;
3273
+ /** Validation issues found during invoice processing. Present only when there are one or more validation findings. An empty list is omitted. */
3274
+ validation_issues?: InvoiceValidationIssue[];
3275
+ /** External identifiers assigned to this invoice by third-party systems. */
3276
+ external_references?: InvoiceExternalReferences;
3277
+ /** Discriminator field identifying this as a standard invoice. */
3278
+ type: 'standard';
3279
+ /** Current lifecycle status of the invoice. */
3280
+ status: 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided';
3281
+ /** Detailed status information including available actions and workflow state. */
3282
+ status_details: InvoiceStatusDetails;
3283
+ /** Timestamp when the invoice was issued to the customer. */
3284
+ issued_at?: string;
3285
+ /** Timestamp until which the invoice remains in draft state. The invoice advances automatically once this time is reached. */
3286
+ draft_until?: string;
3287
+ /** Timestamp when usage quantities were last snapshotted for this invoice. */
3288
+ quantity_snapshotted_at?: string;
3289
+ /** Timestamp when collection was initiated for this invoice. */
3290
+ collection_at?: string;
3291
+ /** Timestamp when payment is due. */
3292
+ due_at?: string;
3293
+ /** Timestamp when the invoice was sent to the customer. */
3294
+ sent_to_customer_at?: string;
3295
+ /** Workflow configuration snapshot captured at invoice creation time. */
3296
+ workflow: InvoiceWorkflowSettings;
3297
+ /** Line items on this invoice. Always returned on single-resource GET; omitted on list endpoints unless explicitly expanded. */
3298
+ lines?: InvoiceStandardLine[];
3299
+ }
2993
3300
  /** Page paginated response. */
2994
3301
  export interface PlanPagePaginatedResponse {
2995
3302
  data: Plan[];
@@ -3020,6 +3327,12 @@ export interface WorkflowPaymentSendInvoiceSettingsInput {
3020
3327
  /** The period after which the invoice is due. With some payment solutions it's only applicable for manual collection method. */
3021
3328
  due_after?: string;
3022
3329
  }
3330
+ export interface InvoiceWorkflowInvoicingSettingsInput {
3331
+ /** Whether to automatically issue the invoice after the draft_period has passed. */
3332
+ auto_advance?: boolean;
3333
+ /** The period for the invoice to be kept in draft status for manual reviews. */
3334
+ draft_period?: string;
3335
+ }
3023
3336
  export interface EventInput {
3024
3337
  /** Identifies the event. */
3025
3338
  id: string;
@@ -3152,6 +3465,12 @@ export interface SubscriptionCancelInput {
3152
3465
  /** If not provided the subscription is canceled immediately. */
3153
3466
  timing?: 'immediate' | 'next_billing_cycle' | string;
3154
3467
  }
3468
+ export interface InvoiceWorkflowInput {
3469
+ /** Invoicing settings for this invoice. */
3470
+ invoicing?: InvoiceWorkflowInvoicingSettingsInput;
3471
+ /** Payment settings for this invoice. */
3472
+ payment?: WorkflowPaymentChargeAutomaticallySettings | WorkflowPaymentSendInvoiceSettingsInput;
3473
+ }
3155
3474
  export interface InvoiceUsageQuantityDetailInput {
3156
3475
  /** The raw quantity as reported by the meter (native units). */
3157
3476
  raw_quantity: string;
@@ -3283,6 +3602,44 @@ export interface AppStripeCreateCheckoutSessionRequestOptionsInput {
3283
3602
  /** Configuration for collecting tax IDs during checkout. */
3284
3603
  tax_id_collection?: AppStripeCreateCheckoutSessionTaxIdCollectionInput;
3285
3604
  }
3605
+ export interface InvoiceWorkflowSettingsInput {
3606
+ /** The apps that will be used to orchestrate the invoice's workflow. */
3607
+ apps?: InvoiceWorkflowAppsReferences;
3608
+ /** The billing profile that was the source of this workflow snapshot. */
3609
+ source_billing_profile: ProfileReference;
3610
+ /** The workflow configuration that was active when the invoice was created. Only the fields that are meaningful at the per-invoice level are included: invoicing behaviour (auto-advance, draft period) and payment settings (collection method, due date). Profile-wide settings such as collection alignment, progressive billing, and tax policy are omitted. */
3611
+ workflow: InvoiceWorkflowInput;
3612
+ }
3613
+ export interface InvoiceDetailedLineInput {
3614
+ id: string;
3615
+ /** Display name of the resource. Between 1 and 256 characters. */
3616
+ name: string;
3617
+ /** Optional description of the resource. Maximum 1024 characters. */
3618
+ description?: string;
3619
+ labels?: Labels;
3620
+ /** An ISO-8601 timestamp representation of entity creation date. */
3621
+ created_at: string;
3622
+ /** An ISO-8601 timestamp representation of entity last update date. */
3623
+ updated_at: string;
3624
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3625
+ deleted_at?: string;
3626
+ /** The service period covered by this detailed line. */
3627
+ service_period: ClosedPeriod;
3628
+ /** Aggregated financial totals for the detailed line. */
3629
+ totals: Totals;
3630
+ /** The cost category of this detailed line. */
3631
+ category?: 'regular' | 'commitment';
3632
+ /** Discounts applied to this detailed line. */
3633
+ discounts?: InvoiceLineDiscounts;
3634
+ /** Credit applied to this detailed line. */
3635
+ credits_applied?: InvoiceLineCreditsApplied[];
3636
+ /** External identifiers for this detailed line. */
3637
+ external_references?: InvoiceLineExternalReferences;
3638
+ /** The quantity of the detailed line. */
3639
+ quantity: string;
3640
+ /** The unit price of the detailed line. */
3641
+ unit_price: string;
3642
+ }
3286
3643
  export interface CreditGrantPagePaginatedResponseInput {
3287
3644
  data: CreditGrantInput[];
3288
3645
  meta: PaginatedMeta;
@@ -3337,6 +3694,42 @@ export interface WorkflowInput {
3337
3694
  /** The tax settings for this workflow */
3338
3695
  tax?: WorkflowTaxSettingsInput;
3339
3696
  }
3697
+ export interface InvoiceStandardLineInput {
3698
+ id: string;
3699
+ /** Display name of the resource. Between 1 and 256 characters. */
3700
+ name: string;
3701
+ /** Optional description of the resource. Maximum 1024 characters. */
3702
+ description?: string;
3703
+ labels?: Labels;
3704
+ /** An ISO-8601 timestamp representation of entity creation date. */
3705
+ created_at: string;
3706
+ /** An ISO-8601 timestamp representation of entity last update date. */
3707
+ updated_at: string;
3708
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3709
+ deleted_at?: string;
3710
+ /** The type of charge this line item represents. */
3711
+ type: 'standard_line';
3712
+ /** Indicates whether this line item's lifecycle is controlled by OpenMeter or manually overridden by the API user. */
3713
+ lifecycle_controller: 'system' | 'manual';
3714
+ /** The service period covered by this invoice, spanning the earliest line start to the latest line end across all of its lines. For an invoice with no lines the period is empty, which means `from` will be equal to `to`. */
3715
+ service_period: ClosedPeriod;
3716
+ /** Aggregated financial totals for the line item. */
3717
+ totals: Totals;
3718
+ /** Discounts applied to this line item. */
3719
+ discounts?: InvoiceLineDiscounts;
3720
+ /** Credit applied to this line item. */
3721
+ credits_applied?: InvoiceLineCreditsApplied[];
3722
+ /** External identifiers for this line item assigned by third-party systems. */
3723
+ external_references?: InvoiceLineExternalReferences;
3724
+ /** Reference to the subscription item that generated this line. */
3725
+ subscription?: SubscriptionReference;
3726
+ /** The rate card configuration snapshot used to price this line item. */
3727
+ rate_card: InvoiceLineRateCard;
3728
+ /** Detailed sub-lines that this line has been broken down into. Present when line has individual details. */
3729
+ detailed_lines: InvoiceDetailedLineInput[];
3730
+ /** Reference to the charge associated with this line item. */
3731
+ charge?: ChargeReference;
3732
+ }
3340
3733
  export interface PlanPhaseInput {
3341
3734
  /** Display name of the resource. Between 1 and 256 characters. */
3342
3735
  name: string;
@@ -3529,6 +3922,56 @@ export interface ProfilePagePaginatedResponseInput {
3529
3922
  data: ProfileInput[];
3530
3923
  meta: PaginatedMeta;
3531
3924
  }
3925
+ export interface InvoiceStandardInput {
3926
+ id: string;
3927
+ /** Optional description of the resource. Maximum 1024 characters. */
3928
+ description?: string;
3929
+ labels?: Labels;
3930
+ /** An ISO-8601 timestamp representation of entity creation date. */
3931
+ created_at: string;
3932
+ /** An ISO-8601 timestamp representation of entity last update date. */
3933
+ updated_at: string;
3934
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3935
+ deleted_at?: string;
3936
+ /** Human-readable invoice number generated by the invoicing app. */
3937
+ number: string;
3938
+ /** Three-letter ISO 4217 currency code for the invoice. */
3939
+ currency: string;
3940
+ /** Snapshot of the supplier's contact information at the time the invoice was issued. */
3941
+ supplier: Supplier;
3942
+ /** Snapshot of the customer's information at the time the invoice was issued. */
3943
+ customer: InvoiceCustomer;
3944
+ /** Aggregated financial totals for the invoice. */
3945
+ totals: Totals;
3946
+ /** The service period covered by this invoice. For flat fee the service period can be empty which means `from` will be equals to `to`. In other cases those fields will be filled with the actual service period. */
3947
+ service_period: ClosedPeriod;
3948
+ /** Validation issues found during invoice processing. Present only when there are one or more validation findings. An empty list is omitted. */
3949
+ validation_issues?: InvoiceValidationIssue[];
3950
+ /** External identifiers assigned to this invoice by third-party systems. */
3951
+ external_references?: InvoiceExternalReferences;
3952
+ /** Discriminator field identifying this as a standard invoice. */
3953
+ type: 'standard';
3954
+ /** Current lifecycle status of the invoice. */
3955
+ status: 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided';
3956
+ /** Detailed status information including available actions and workflow state. */
3957
+ status_details: InvoiceStatusDetails;
3958
+ /** Timestamp when the invoice was issued to the customer. */
3959
+ issued_at?: string;
3960
+ /** Timestamp until which the invoice remains in draft state. The invoice advances automatically once this time is reached. */
3961
+ draft_until?: string;
3962
+ /** Timestamp when usage quantities were last snapshotted for this invoice. */
3963
+ quantity_snapshotted_at?: string;
3964
+ /** Timestamp when collection was initiated for this invoice. */
3965
+ collection_at?: string;
3966
+ /** Timestamp when payment is due. */
3967
+ due_at?: string;
3968
+ /** Timestamp when the invoice was sent to the customer. */
3969
+ sent_to_customer_at?: string;
3970
+ /** Workflow configuration snapshot captured at invoice creation time. */
3971
+ workflow: InvoiceWorkflowSettingsInput;
3972
+ /** Line items on this invoice. Always returned on single-resource GET; omitted on list endpoints unless explicitly expanded. */
3973
+ lines?: InvoiceStandardLineInput[];
3974
+ }
3532
3975
  export interface PlanPagePaginatedResponseInput {
3533
3976
  data: PlanInput[];
3534
3977
  meta: PaginatedMeta;